Document ClassesEnvironment Length Problem

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
mev
Posts: 4
Joined: Mon Aug 25, 2008 3:39 pm

Environment Length Problem

Post by mev »

A few months ago I adjusted a PhD thesis class file so that it was all set up to work with our department and university name, etc, as well as formatting everything in the particular manner they, in their infinite wisdom, have decided upon. A few of my friends are now using this class file and starting to find a few little oddities I hadn't ironed out.

A major one at the moment seems to be when there is more than a single page worth of text in (for instance) the abstract environment. If there is, the title ends up stranded at the bottom of one page, and the text starting on the next! =-(

Here's the bit of code to define the abstract:

Code: Select all

\newenvironment{abstract}
{
  \btypeout{Abstract Page}
  \thispagestyle{empty}
  \null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
    {\normalsize \UNIVNAME \par}
    \bigskip
    {\underline{ABSTRACT} \par}
    \bigskip
    {\normalsize \FACNAME \par}
    {\normalsize \DEPTNAME \par}
    \bigskip
    {\normalsize \underline{Doctor of Philosophy}\par}
    \bigskip
    {\normalsize\bf \title \par}
    \medskip
    {\normalsize by \authornames \par}
    \bigskip
  \end{center}
}
I'm only really a beginner at class writing, so this one has me completely foxed. Does anyone have any ideas?

Cheers

Mark

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Re: Environment Length Problem

Post by Stefan Kottwitz »

Hi Mark,

welcome to the board!
The \vfil at the beginning of the abstract environment will push the following text to the bottom of the page. Try it without it.
By the way \bf is an obsolete command (like \rm, \sf, \tt, \it, \sc, \sl), use \bfseries instead.

Stefan
LaTeX.org admin
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Environment Length Problem

Post by Juanjo »

In addition to Stefan_K advice, it seems that you don't use correctly the \newenvironment command: it has two mandatory arguments, one for the code to be executed at the beginning of the environment, and other, for the code to be run at the end:

Code: Select all

\newenvironment{env_name}{opening_code}{closing_code}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Environment Length Problem

Post by Stefan Kottwitz »

Hi,

just a short explanation why your definition of the abstract did not produce an error even if you omitted the mandatory argument, what Juanjo found out.
Probably you have an empty line following the definition above. This is equivalent to a paragraph break, that's why \endabstract will be defined as \par and no error will be raised. If you didn't have that empty line there would be an error. For example, if the abstract definition was written right before \begin{document}, \endabstract would contain \begin and the error Missing \begin{document} would be raised.

Stefan
LaTeX.org admin
mev
Posts: 4
Joined: Mon Aug 25, 2008 3:39 pm

Environment Length Problem

Post by mev »

Thanks guys! Have been through and fixed the problems you've pointed out.

Sorry, I have one more question!

I'd made the same mistakes when defining an acknowledgements command. This now happily works on 2 pages, but, because it comes in after the various lists of contents, figures, etc, the second page carries the heading from the last list.

Is there a way of defining a text string LaTeX can use as a page header?

Cheers

Mark
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Environment Length Problem

Post by Stefan Kottwitz »

Hi Mark,

you could use \markboth for that purpose.

Stefan
LaTeX.org admin
mev
Posts: 4
Joined: Mon Aug 25, 2008 3:39 pm

Environment Length Problem

Post by mev »


Hi Stefan,

Sorry, \markboth or \markright allows me to control the headings on the first acknowledgements page, but when it runs over onto a second the preceeding page headers (in this case 'List of Tables') overrides my command.

Cheers

Mark
Post Reply