Page LayoutTwo Questions: List of My Own Environment & Section Markers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
youngprof
Posts: 8
Joined: Thu Apr 08, 2010 9:18 pm

Two Questions: List of My Own Environment & Section Markers

Post by youngprof »

Hi,

I have two questions:

1 - The easier one) If I want to have an unnumbered section (\section*{...}) how can I get it to show up in \rightmark? I know how to add it to the Table of Contents (\addcontentsline) and that adds it to the PDF structure as well but I don't really know how to work with \rightmark.

2 - Possibly harder) I've defined an environment and would like to get a list of all of those to put with my ToC (something like List of Figures, Tables, Listings, etc. but for my environment). I've been told this can be done with the `float' package, but I'd rather not have my environment be a float. Does anyone know any other ways to achieve this?

I'm sorry if this is a duplicate, I couldn't find these in the forums before.

YP

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
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Two Questions: List of My Own Environment & Section Markers

Post by gmedina »

Hi,

1) Use \marboth or \markright.

2) You can use, for example, the \newlistof command provided by the tocloft package; see Section 2.4 "New list of ..." of the package documentation for a detailed explanation.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
youngprof
Posts: 8
Joined: Thu Apr 08, 2010 9:18 pm

Re: Two Questions: List of My Own Environment & Section Mark

Post by youngprof »

Thank you so much for the quick answer - I haven't had time to get back here much with the end of the semester.

The tocloft package works great! But could you explain a little more how to work with \markboth & \markright? My first attempts made the formatting pretty wild.]

YP
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Two Questions: List of My Own Environment & Section Markers

Post by gmedina »

youngprof wrote:Thank you so much for the quick answer - I haven't had time to get back here much with the end of the semester...
You're welcome - No problem.
youngprof wrote:...The tocloft package works great! But could you explain a little more how to work with \markboth & \markright?..
Of course I can explain a little more, but it would be better if you let us know exactly how do you want your headers/footers to look like for the unnumbered section created with \section*.

This little example perhaps could give you some hints:

Code: Select all

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{\rightmark}
\usepackage{lipsum} % just to generate some text for the example

\begin{document}
\section{Test section}
\markright{Test section}
\lipsum[1-30]
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
youngprof
Posts: 8
Joined: Thu Apr 08, 2010 9:18 pm

Two Questions: List of My Own Environment & Section Markers

Post by youngprof »

Great!! - I think this should illustrate what I'd like to do:

Code: Select all

\documentclass[10pt]{book}
\usepackage{lastpage, fancyhdr, lipsum}

\pagestyle{fancyplain}
\lhead[\fancyplain{}{MY NAME}]{\fancyplain{}{\rightmark}}
\rhead[\fancyplain{}{\rightmark}]{\fancyplain{}{MY NAME}}

\title{abc}
\author{def}
\begin{document}
\tableofcontents
\thispagestyle{empty}
\chapter{The First Chapter}
\section{A First Section}
\lipsum[1-4]
\section*{A Different Section}
\addcontentsline{toc}{section}{A Different Section}
\lipsum[5-12]
\end{document}
1) I'd like page 5 to have "A Different Section" where "A First Section" is now showing up.

2) I'd like page 2 to be blank, but for how it still has a header - I thought \thispagestyle would work but it doesn't work for {empty} or {plain}

3)If you have advice on how I could get the two "A"'s to line up in the toc too that'd be great but I might be able to get that out of tocloft (I haven't really worked with it yet).

Thank you again
youngprof
Posts: 8
Joined: Thu Apr 08, 2010 9:18 pm

Two Questions: List of My Own Environment & Section Markers

Post by youngprof »

Regarding #2 - I just figured that out

Code: Select all

\tableofcontents~\\
\newpage
\thispagestyle{plain}

forces the \thispagestyle onto page 2 where it's not fighting with \tableofcontents.

Thanks for your help with the other 2 though!
Post Reply