Hi Will,
You have many questions so I will answer below...
On 01/06/2010 11: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).
There are a few. Steve Litt and Rob Oakes post here often and they have
such instructions online. Try google.
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?
It is. In the .layout, have the line "InTitle" keyword, e.g.
Style Abstract
InTitle 1
...
End
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?
I have done similar things in either in ERT, like you, or with a Style
in the .layout which is meant only as a separator. You can use:
Input stdstruct.inc
Style End_Front_Matter
CopyStyle Separator
LatexName frontmatterend%
End
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?
Possible for sure.
AddToPreamble
\usepackage{tocbibind}
EndPreamble
The second part of your question requires some creativity.
I asked several questions -- if you only want to answer one, the answer will
still be appreciated, thanks!
Have a look at the Help manuals > Customization !
Will
Cheers,
Julien
%--------------------------------------------------------------------
% \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.
}
--
Julien