Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

boldface in subsection titles and table of contents

622 views
Skip to first unread message

Howard Haber

unread,
Oct 7, 2008, 1:29:28 AM10/7/08
to
I am using the standard article style with ams enhancements:
\documentclass[11pt]{article}
\usepackage{amssymb,amsmath,amsbsy}

In a report that I am co-authoring, we have sections, subsections and
subsubsections. We also have a table of contents which we include after
the abstract with the \tableofcontents command. The style of the
section titles that appear in the table of contents gives boldface
titles for sections but no boldface for subsections and subsubsections.
This is the way I like it. In the body of the report, all section,
subsection, and subsubsection titles are in boldface. Again, this is good.

Now, here is the problem. The math (in math mode) in the section titles
does NOT appear in boldface. The usual workaround is to put the math
inside a \boldsymbol{...}, which certainly does the trick. But then,
the table of contents looks weird with all math in boldface in the
subsection and subsubsection titles, but no boldface for the non-math
mode stuff.

Is there any way to have the math appear boldface in all section,
subsection and subsubsection titles in the body of the report, but for
the subsection and subsubsection titles in the table of contents to
remain un-boldfaced (even with math in the titles)?

Thanks for any suggestions.

Howard Haber

Paul W. Elsinghorst

unread,
Oct 7, 2008, 2:09:55 AM10/7/08
to
You could use a starred command and add an extra line to the toc like
this:

\phantomsection\addcontentsline{toc}{subsubsection}{Your line symbols}
\subsubsection*{Your line \boldsymbols{}}

Obviously this works for any hierarchy of the toc.

Paul

jon

unread,
Oct 7, 2008, 2:23:58 AM10/7/08
to
On Oct 7, 1:29 am, Howard Haber <ha...@ucsc.edu> wrote:
>
> Is there any way to have the math appear boldface in all section,
> subsection and subsubsection titles in the body of the report, but for
> the subsection and subsubsection titles in the table of contents to
> remain un-boldfaced (even with math in the titles)?

\section[<toc-entry>]{<section title>}
\subsection[<toc-entry>]{<section title>}

should do the trick. this way you can even make your table of
contents seem like it was meant for some other article/book (if you
wanted to).

memoir's even better:

\section[<toc-entry>][<header title>]{<section title>}

(if you use only one optional argument the toc and header will be the
same.)

cheers,
jon.

Wojciech Śmigaj

unread,
Oct 7, 2008, 6:10:22 AM10/7/08
to
Howard Haber wrote:
> [...]

> Is there any way to have the math appear boldface in all section,
> subsection and subsubsection titles in the body of the report, but for
> the subsection and subsubsection titles in the table of contents to
> remain un-boldfaced (even with math in the titles)?

You can redefine the commands typesetting section titles in the body and
in the table of contents to make them use the bold variant of the maths
fonts (by the \boldmath macro), e.g. putting the following code in your
preamble:

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries\boldmath}} % \boldmath added

\renewcommand*\l@section[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries \boldmath % \boldmath added
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
\makeatother

In this way, you don't need to specify different variants of titles to
appear in the body and in the TOC.

Note that emboldening maths in headers might not always be a good idea,
since the bold typeface is usually reserved for vectors/matrices etc.,
so by typesetting a scalar in bold you risk confusion of your readers.

Hope this helps,
Wojciech Śmigaj

Hongyi Zhao

unread,
Oct 8, 2008, 1:24:52 AM10/8/08
to
On Oct 07, 2:23 PM +0800, jon <jonwro...@gmail.com> wrote:
> On Oct 7, 1:29 am, Howard Haber <ha...@ucsc.edu> wrote:
>> Is there any way to have the math appear boldface in all section,
>> subsection and subsubsection titles in the body of the report, but for
>> the subsection and subsubsection titles in the table of contents to
>> remain un-boldfaced (even with math in the titles)?
>
> \section[<toc-entry>]{<section title>}
> \subsection[<toc-entry>]{<section title>}
>
> should do the trick. this way you can even make your table of
> contents seem like it was meant for some other article/book (if you
> wanted to).
>
> memoir's even better:
>
> \section[<toc-entry>][<header title>]{<section title>}

Can I use the above code for other class than memoir, e.g., book class
of LaTeX?

Regards,
--
Hongyi Zhao <hongy...@gmail.com>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences

Robin Fairbairns

unread,
Oct 8, 2008, 6:13:37 AM10/8/08
to
Hongyi Zhao <hongy...@gmail.com> writes:
>On Oct 07, 2:23 PM +0800, jon <jonwro...@gmail.com> wrote:
>> On Oct 7, 1:29 am, Howard Haber <ha...@ucsc.edu> wrote:
>>> Is there any way to have the math appear boldface in all section,
>>> subsection and subsubsection titles in the body of the report, but for
>>> the subsection and subsubsection titles in the table of contents to
>>> remain un-boldfaced (even with math in the titles)?
>>
>> \section[<toc-entry>]{<section title>}
>> \subsection[<toc-entry>]{<section title>}
>>
>> should do the trick. this way you can even make your table of
>> contents seem like it was meant for some other article/book (if you
>> wanted to).
>>
>> memoir's even better:
>>
>> \section[<toc-entry>][<header title>]{<section title>}
>
>Can I use the above code for other class than memoir, e.g., book class
>of LaTeX?

not the code \section[toc][header]{title}, which is memoir specific.
all the other stuff is common to latex standard classes (and works in
memoir too).
--
Robin Fairbairns, Cambridge

Howard Haber

unread,
Oct 10, 2008, 5:19:51 AM10/10/08
to
Hi Jon:
Thanks for the tip. I now see how to do it. Indeed, this
information was in The LaTeX Companion---I had just missed the key
sentence.
I only wish that \section{...} was smart enough to boldface the
math, but I can tolerate the extra \boldsymbol here and there.

--Howard

0 new messages