Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 031ad4b

Browse files
committed
\mytableofcontents New macro. Wrapper around \tableofcontents that
does the right thing if the openright option is given. Allows a lot of crud to be removed from the document files' frontmatter sections. \endabstract Extend standard macro. (Called as \end{abstract}.) Does the right thing if the openright option is given. \optional Adjust to get the brackets right under latex2e.
1 parent 46fbd7f commit 031ad4b

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

Doc/myformat.sty

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
\newcommand{\funcline}[2]{\item[\code{#1(\varvars{#2})}]\ttindex{#1}}
159159
\newcommand{\funcdesc}[2]{\fulllineitems\funcline{#1}{#2}}
160160
\let\endfuncdesc\endfulllineitems
161-
\newcommand{\optional}[1]{{\ \Large[}{#1}\hspace{0.5mm}{\Large]}\ }
161+
\newcommand{\optional}[1]{{\ \textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}\ }
162162

163163

164164
% same for excdesc
@@ -253,3 +253,39 @@
253253
\OldTheindex%
254254
\addcontentsline{toc}{chapter}{\indexname}%
255255
}
256+
257+
% Use a similar trick to catch the end of the {abstract} environment,
258+
% but here make sure the abstract is followed by a blank page if the
259+
% 'openright' option is used.
260+
%
261+
\let\OldEndAbstract=\endabstract
262+
\def\endabstract{%
263+
\if@openright%
264+
\ifodd\value{page}%
265+
\typeout{Adding blank page after the abstract.}%
266+
\vfil\pagebreak%
267+
\fi
268+
\fi%
269+
\OldEndAbstract%
270+
}
271+
272+
% \mytableofcontents wraps the \tableofcontents macro with all the magic to
273+
% get the spacing right and have the right number of pages if the 'openright'
274+
% option has been used. This eliminates a fair amount of crud in the
275+
% individual document files.
276+
%
277+
\newcommand{\mytableofcontents}{%
278+
\pagebreak%
279+
\pagestyle{plain}%
280+
{%
281+
\parskip = 0mm%
282+
\tableofcontents
283+
\if@openright
284+
\ifodd\value{page}%
285+
\typeout{Adding blank page after the table of contents.}%
286+
\pagebreak\hspace{0pt}%
287+
\fi
288+
\fi
289+
}
290+
\pagebreak%
291+
}

0 commit comments

Comments
 (0)