Hi Will, This article might be of some interest:
http://blog.oak-tree.us/index.php/2009/11/02/custom-lyx-nih As might this one, though it describes working with the local layout of a file rather than a module. (The same principles for adding character styles to a module/document layout are the same.) http://blog.oak-tree.us/index.php/2009/11/14/customize-lyx-character-styles There is also a wealth of information available from the LyX wiki. http://wiki.lyx.org/Layouts/CreatingLayouts The answer to your other questions are "Yes". The information in the two articles above should help you get started (and may even be enough to help you sort it out). If not, feel free to shoot me an email and I'd be happy to try and walk you through it. Cheers, Rob Oakes On Jun 1, 2010, at 9:35 AM, Will wrote: > I am trying to modify the book class for my thesis. I have a LaTeX class > file which basically woks, but there are a few suboptimal interactions with > LyX right now that I would like to correct (so I could give the *.cls and > *.layout files to other students writing theses at my school). > > I have one side question first. Is there an introduction to how to write new > layouts posted anywhere on the internet? The only layout documentation I > have been able to find describes how to modify an existing layout to use a > new LaTeX *.cls or *.sty file and advises users to look at previous layout > files for examples (which I find frustrating). > > The main thing I want to do is add an abstract in front of my title page. > Right now I modify the \maketitle command to include the abstract before the > title page. I define abstractText{} which contains the text for the > abstract. I have to put this in the preamble right now because of the way > LyX formats the LaTeX (it puts \maketitle before \abstractText{} if I try to > put \abstractText{} into the main document). I would like to be able to type > the abstract text into the main document using an environment selected from > the environment drop down box. > > Maybe it's easy to modify my existing layout/class files to do this? Or > maybe I should redefine things with the abstract outside of maketitle? My > layout file is just a copy of book.layout modified as directed in the > Customization documentation. The relevant part of my class file is shown at > the end of the email. > > There are a couple other minor uses of ERT in my document right now that I > would like to remove by modifying my layout/class if possible: > > 1. I restart the page numbering in arabic when I get to chapter 1. Right now > I do this by putting \frontmatterend in ERT right before chapter 1. Is there > any way to make this part of the my layout/class? Or make \frontmatterend > somehow something that is selectable from a menu so you don't have to know to > type it in by hand? > > 2. For my front matter, right now I use Chapter* for the different sections > (acknowledgments, glossary, etc). To get these in the table of contents, I > have \usepackage{tocbibind} in the preamble and put > \addcontentsline{toc}{chapter}{Glossary} in front of each section. Is there > any way to put \usepackage{tocbibind} into the layout file and make > Chapter*'s have the \addcontentsline{toc}{chapter}{Glossary} line added by > default? > > I asked several questions -- if you only want to answer one, the answer will > still be appreciated, thanks! > > Will > > %-------------------------------------------------------------------- > > % \advisor{} > %-------------------------------------------------------------------- > \def\advisor#1{\gd...@dvisor{#1}} > \d...@dvisor{\@la...@warning@n...@line{no \noexpand\advisor given}} > %-------------------------------------------------------------------- > % \abstractText{} > %-------------------------------------------------------------------- > \def\abstracttext#1{\gd...@bstracttext{#1}} > \d...@bstracttext{\@la...@warning@n...@line{no \noexpand\abstractText given}} > %-------------------------------------------------------------------- > % \makecopyright > %-------------------------------------------------------------------- > \newcommand{\makecopyright}{% > \hbox{\hfil}\vspace{1.5in}\begin{center} > \begin{singlespace} > Copyright \copyright\ \the\year\ by \...@author \\ > All rights reserved. > \end{singlespace} > \end{center} > \clearpage > }% > %-------------------------------------------------------------------- > % \frontmatterend > %-------------------------------------------------------------------- > \newcommand{\frontmatterend}{% > \setcounter{page}{0} > \pagenumbering{arabic} > }% > %-------------------------------------------------------------------- > % Customize \maketitle > %-------------------------------------------------------------------- > \renewcommand\maketitle{\begin{titlepage}% > \begin{center} > {\bf Abstract}\par\bigskip > {\Large \bf \...@title}\par\bigskip > \...@author \\ > \the\year \\ > \...@bstracttext > \end{center} > \clearpage > \pagestyle{empty} > \null \vskip 40\p@ > \begin{center}% > {\LARGE\bf \...@title \par}% > \vfil > \begin{singlespace} > {\large > A Dissertation\\ > Presented to the Faculty of the Graduate School\\ > of\\ > Some University\\ > in Candidacy for the Degree of\\ > Doctor of Philosophy\par\vfil\vskip 6ex% > by\\ > \...@author\par\vskip 1.5em% > Dissertation Director: \...@dvisor\par > }\vskip 1.5em% > {\large \...@date \par > }% > \clearpage > \end{singlespace} > \end{center} > \pagestyle{plain} % Page numbers at bottom center. > \pagenumbering{roman} % roman numerals. > \addtocounter{page}{1} %This is page i, but not shown -- Next page is ii. > \makecopyright > \end{titlepage}% > \global\let\maketitle\relax > \global\let\title\relax > \global\let\author\relax > \global\let\advisor\relax > \global\let\date\relax > \global\let\and\relax > \pagestyle{plain} % Page numbers at bottom center. > \pagenumbering{roman} % roman numerals. > \addtocounter{page}{2} %This is page i, but not shown -- Next page is ii. > }