Heading/Footer Indenting

515 views
Skip to first unread message

dou...@gmail.com

unread,
Jul 1, 2007, 1:18:07 PM7/1/07
to LaTeX Users Group
Hi,

I'm using the article class and I need to remove the indentation from
the initial line of footers. I also have to have the heading titles
indented to a certain distance after the heading number. Does anyone
know of a way of doing this? I don't even mind editing the class file
if necessary, I just don't know what to edit.

Thanks,

-Dougal

Werner Grundlingh

unread,
Jul 1, 2007, 9:55:01 PM7/1/07
to LaTeX Users Group

To address your footnote indentation problem. Use the footmisc
package, available from CTAN at
http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=footmisc
Consider, for example, the following minimal document:

\documentclass{book}
\usepackage{lipsum}
\usepackage[hang,flushmargin]{footmisc}

\begin{document}
This is\footnote{\lipsum[1]} just a test. This is just
\footnote{\lipsum[2]} another test. \lipsum[1]
\end{document}

The 'hang' option flushes the footnote marker to the left margin of
the page, while the 'flushmargin' option flushes the text as well. The
documentation displays some other options that you could fiddle with
to obtain the results you require.

Werner

Werner Grundlingh

unread,
Jul 1, 2007, 10:38:07 PM7/1/07
to LaTeX Users Group
On Jul 1, 10:18 am, "doug...@gmail.com" <doug...@gmail.com> wrote:

To address your heading title indentation, consider the 'hack'
mentioned on page 15 and onward (Section 8.4) of the sectsty package,
available from CTAN at
http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=sectsty
The hack doesn't require the sectsty package though. The following
minimal example shows the effect of adding a 4cm space after the
section number. You individually control the spacing after every
sectional command (\section, \subsection, and \subsubsection), which
is typically given by a \quad:

\documentclass{article}

\usepackage{lipsum}
\usepackage{ifthen}

\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname the#1\endcsname\quad}% default
{\csname #1@cntformat\endcsname}% individual control
}%
\def\section@cntformat{\thesection\hspace{4cm}}
\def\subsection@cntformat{\thesubsection\hspace{4cm}}
\def\subsubsection@cntformat{\thesubsubsection\hspace{4cm}}
\makeatother

\begin{document}

\section{First section}
\lipsum[1]
\subsection{first subsection}
\lipsum[2]
\subsection{second subsection}
\lipsum[3]
\subsection{third subsection}
\lipsum[4]

\section{Second section}
\lipsum[5]
\subsection{first subsection}
\lipsum[6]
\subsection{second subsection}
\lipsum[7]
\subsection{third subsection}
\lipsum[8]

\section{Third section}
\lipsum[9]
\subsection{first subsection}
\lipsum[10]
\subsection{second subsection}
\lipsum[11]
\subsection{third subsection}
\lipsum[12]

\end{document}

If you're interested in having the sectional number and space
thereafter to be exactly (say) 4cm wide (in other words, now the
sectional headings will line up below one another, rather than (say)
section 1.9 and section 1.10 being just a little off because of the
width difference between '9' and '10'), you could use the following
instead

\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
{\csname the#1\endcsname\quad}% default
{\csname #1@cntformat\endcsname}% individual control
}%
\def\section@cntformat{\hbox to 4cm{\thesection\hss}}
\def\subsection@cntformat{\hbox to 4cm{\thesubsection\hss}}
\def\subsubsection@cntformat{\hbox to 4cm{\thesubsubsection\hss}}
\makeatother

Do not try to set these lengths in terms of em's or ex's (like 4em, or
3ex), because different sections have different font sizes specified,
which in turn would result in different lengths (albeit just
slightly). That is, a length of 4ex in a section heading is different
from a length of 4ex in a subsection heading, which again is different
from a length of 4ex in a subsubsection heading.

Alternatively, the titlesec package, available from CTAN at
http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=titlesec
will also be able to format the sectional headings to your liking. The
command used for changing sectional formatting (and spacing) is given
by
\titleformat{<command>}[<shape>]{<format}{<label>}{<sep>}{<before>}
[<after>]
where you're probably interested in specifying the value of <sep>. See
page 3 of the titlesec documentation.

Werner

dou...@gmail.com

unread,
Jul 3, 2007, 7:09:10 AM7/3/07
to LaTeX Users Group
Your solutions worked perfectly. Thanks a lot, I really appreciate the
help.

-Dougal

Reply all
Reply to author
Forward
0 new messages