TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm producing the final product of my thesis with LaTeX. I'm having trouble with the front matter of my thesis, specifically with getting LaTeX to recognize that if the front matter stops at a certain number of pages, then it is to execute the command \beginthesis.

I've tried to produce counters so that if a certain combination of counters produced a certain number, and it was greater than X, it would produce a new front matter page via \newpage, but if less than X, it would execute \beginthesis.

So, in simplified form, the whole process looks something like this, with abstract being the absolute last page that can be present:




\ifnum\value{frontmattercounter} > 1


I have about 6 or 7 pages that I have set up this way, but for some reason, it seems that LaTeX is not recognizing the values properly. Is there a better way to do this, or is there a way I can modify my process to get the intended result? Thanks in advance.

share|improve this question
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Martin Scharrer Oct 29 '11 at 18:12
It's not clear what you're going to achieve. Isn't issuing \beginthesis sufficient? – egreg Oct 29 '11 at 20:51
Martin, thanks and thanks for for the tip! I'll file that away for future use. – user8934 Oct 30 '11 at 1:13
egreg, the \beginthesis command does something different with page formatting and number so it can't be used in the front matter. What I'm looking to do is find a way to have LaTeX understand that if there isn't an abstract page, for instance, it will \beginthesis, but if there is an abstract page, then it will do a \newpage. – user8934 Oct 30 '11 at 1:15
Where can we find the class you're using? A tip: if you precede the nickname of somebody with @ at the start of a comment, they will be notified. – egreg Oct 30 '11 at 14:11
up vote 1 down vote accepted

I'm going to take a somewhat blind shot at "is there a better way?" My university's thesis style requires some pages in the front matter, while other pages are optional. Pages in the front matter get one type of headers and footers, while pages in the main matter and back matter get another style. The following is the basic structure I use, where students are expected to provide their own abstract and other front matter content, and to comment out the pages they don't use:

\usepackage[english]{babel} \usepackage{blindtext} % For filler text
%%% Things that should go in a .sty file the student doesn't normally touch

% Use \somethingpage commands to define the layout of a frontmatter page,
% and include the content of the student's \thesissomething command.
\newcommand{\epigraphpage}{\cleardoublepage \thesisepigraph \cleardoublepage}
\newcommand{\abstractpage}{\cleardoublepage \thesisabstract \cleardoublepage}
% Provide default \thesissomething commands to prompt the student in case
% they forgot to enter their own content.
This is the default epigraph. You need to change it by editing the
thesisepigraph command in your own thesis.tex file
This is the default abstract. You need to change it by editing the
thesisabstract command in your own thesis.tex file

%%% Things that should go in each student's .tex file
This is my epigraph.

This is my abstract.

\frontmatter \pagestyle{plain}

\epigraphpage % Comment this out if there's no epigraph to include
\abstractpage % Don't comment this out, abstract is required

\mainmatter \beginthesis

\fbox{Figure content goes here}
\caption{Some caption goes here}


\chapter{Something Else}
Here goes the back matter.


There are some more sophisticated techniques available (e.g., patching the \mainmatter command to execute \beginthesis automatically), but maybe this is a starting point to figure out what's really required.

share|improve this answer
Mike, thanks for this approach. Let me mull over it for a day or two. – user8934 Oct 31 '11 at 6:29
I ultimately took this path with some modification and it worked. Thanks very much! – user8934 Jan 15 '12 at 22:11
When you get a chance, you can accept my answer and close out the question. – Mike Renfro Jan 15 '12 at 22:35
Done. Thanks once again. – user8934 Jan 16 '12 at 1:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.