Setting LaTeX Preamble in Tufte Book using Fancyhdr

970 views
Skip to first unread message

mojohn

unread,
Apr 13, 2011, 9:08:23 PM4/13/11
to tufte-latex
I copied the text of the Book of Matthew from the NET Bible (bible.org
- which permits reprinting the text of the entire Bible pretty much
without restriction) and pasted it into a Tufte Book document class. I
used Chapter* for the book name, and Section* for each of the topic
headings. The rest of the book is formatted using Standard. The book
is formatted with facing pages.

I am using fancyhdr, and want to print the book name in the Left Outer
area and the first Section on the page in the Left Inner area. Then,
on the inner page, I want to print the book name in the Right Outer
area and the last Section on the page in the Right Inner area.

I copied the following preamble into the LaTex Preamble section of LyX
1.6.5 (from a PDF written by Piet van Oostrum).

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[LE,RO]{}
\fancyhead[LO,RE]{}
\fancyfoot{} % clear all footer fields
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{1.5pt}
\renewcommand{\footrulewidth}{0.4pt}

I tinkered with it using instructions in the fancyhdr document, but, I
couldn't get it to work.

Any help programming the Preamble to accomplish what I want will be
much appreciated!

mojohn

Kevin Godby

unread,
Apr 13, 2011, 9:38:58 PM4/13/11
to tufte...@googlegroups.com, mojohn
Hello.

The Tufte-LaTeX document classes use the fancyhdr package to set up
the running heads and feet. Here are a few pointers that might help
solve the problem:

1. The starred variants of the \chapter* and \section* commands don't
set the markers—you'll need to use the unstarred variants (\chapter
and \section) instead. If you are using the starred versions only to
get rid of the chapter and section numbering, you should look at the
secnumdepth and tocnumdepth counters (see pages 29–30 in the
sample-book.pdf for a list of secnumdepth values).

2. You can use \fancyhf{} to clear the contents of the running heads
and feet all in one shot.

3. The tufte-book class will reset its own running head and feet if
you use the \frontmatter or \mainmatter macros. I would recommend
defining your running heads and feet in a macro and then telling LaTeX
to call that macro any time \frontmatter or \mainmatter are called.
You can use the following code to do that:

\makeatletter% so we can use @ symbols in macro names
\newcommand{\myfancyhf}{%
\fancyhf{}% clear previous contents of running heads/feet
\fancyhead{...your code goes here...}%
\fancyfoot{...your code goes here...}%
}
\g@addto@macro{\frontmatter}{\myfancyhf}% calls \myfancyhf any time
\frontmatter is called
\g@addto@macro{\mainmatter}{\myfancyhf}% likewise for \mainmatter
\makeatother% restores the original meaning of @

After you've taken care of those things, your \fancyhead and
\fancyfoot could should work.

If you continue to encounter problems, please let me know.

Thanks!

--Kevin

Reply all
Reply to author
Forward
0 new messages