There is some problem with this redefinition - in table of contents all
sections are not visible. Bellow is minimal example.
%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,twoside,12pt]{report}
\let\sectionold\section
\renewcommand\section[2][\empty]{%
\boldmath\sectionold[#1]{#2}\unboldmath}
\begin{document}
\tableofcontents
\chapter{Abc}
def
\section{ghi $y=x$}
jkl
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%
Any suggestion is welcome,
jimmij
--
I come from the Land Of Imagination
> There is some problem with this redefinition - in table of contents all
> sections are not visible. Bellow is minimal example.
without a redefinition of section
\section{ghi \boldmath$y=x$\unboldmath}
Herbert
--
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
> without a redefinition of section
>
> \section{ghi \boldmath$y=x$\unboldmath}
Thanks for reply.
I know how to do it without redefination. But I have a lot of sections
with math, so I'm looking for some global way...
regards,
\documentclass[a4paper,twoside,12pt]{report}
\let\sectionold\section
\renewcommand\section[2][]{%
\sectionold{\boldmath #2\unboldmath}}
\begin{document}
\tableofcontents
\chapter{Abc}
def
\section{ghi $y=x$}
jkl
\end{document}
but it makes no sense, the sections are not in bold in the toc ...
HErbert
> \documentclass[a4paper,twoside,12pt]{report}
>
> \let\sectionold\section
> \renewcommand\section[2][]{%
> \sectionold{\boldmath #2\unboldmath}}
>
> \begin{document}
> \tableofcontents
> \chapter{Abc}
> def
> \section{ghi $y=x$}
> jkl
> \end{document}
> but it makes no sense, the sections are not in bold in the toc ...
Ok, looks like I have to write \boldmath or \bm for all sections
separately...
Thanks for help,
> Herbert Voss <Herber...@gmx.net> writes:
>
> > but it makes no sense, the sections are not in bold in the toc ...
>
> Ok, looks like I have to write \boldmath or \bm for all sections
> separately...
Using one of the KOMA-Script classes you could plug \boldmath directly
into the font selection for sections. I am sure that memoir gives you
similar possibilities. There are also different packages on CCTAN for
altering the fonts used for section titles (see the FAQ).
However, please keep in mind that in $x$ and $\bm{x}$ can mean quite
differnt things. I am not convinced that it is a good idea to switch to
a bold font for math in section titles.
cheerio
ralf
actually there's no problem hacking it up the way jimmij wanted to in
the first place.
\let\oldsection\section
\renewcommand\section[2][\sectiontoc]{%
\def\sectiontoc{#2}%
\oldsection[#1]{\boldmath#2}%
}
note the section title is set in a group, so \boldmath doesn't need to
be unwound.
>However, please keep in mind that in $x$ and $\bm{x}$ can mean quite
>differnt things. I am not convinced that it is a good idea to switch to
>a bold font for math in section titles.
it is sometimes. but sometimes it isn't, i agree.
--
Robin (http://www.tex.ac.uk/faq) Fairbairns, Cambridge
> actually there's no problem hacking it up the way jimmij wanted to in
> the first place.
>
> \let\oldsection\section
> \renewcommand\section[2][\sectiontoc]{%
> \def\sectiontoc{#2}%
> \oldsection[#1]{\boldmath#2}%
> }
It seems to work properly :)
I will do the same for chapter and subsections.
Thank you,
> actually there's no problem hacking it up the way jimmij wanted to in
> the first place.
Sure, but that is still more complicated than
%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,twoside,12pt,chapterprefix]{scrreprt}
\addtokomafont{sectioning}{\rmfamily\boldmath}
\begin{document}
\tableofcontents
\chapter{Abc $y=x$}
def
\section{ghi $y=x$}
jkl
\subsection{ghi $y=x$}
jkl
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%
which works for all sectioning levels. Note that 'chpaterprefix' and
'\rmfamily' are used to get closer to the layout of report.cls.
cheerio
ralf
> \let\sectionold\section
> \renewcommand\section[2][]{%
> \sectionold{\boldmath #2\unboldmath}}
I think this is really vile.
It breaks the TOC, as Robin pointed out and fixed.
It is creating a "wrapper" macro when the original
\section is just a wrapper macro too! You should
just redefine \section to include \boldmath where
it specifies \bfseries. Also insert \raggedright.
Even though it is very simple already, there are
packages to allow piecemeal specification of headings:
titlesec.sty, and the Koma and Memoir classes.
--
Donald Arseneau as...@triumf.ca
I think there is no good solution and that it would be better to
avoid mathematics in section titles altogether.
In my Licentiate thesis I used the official visual style of the
university, which meant among other things that I was to use the
official fonts. And the default LaTeX math fonts were just totally
unusable with the section title font. (The default LaTeX math font
doesn't math the text font either, and the architecture students
who designed the visual style didn't consider math fonts at all.)
In the end, I ended up faking it with something like
\section{Attempts to Improve \protect\(
\mbox {\em R}_{\mbox {\scriptsize \em k}}\protect \)(3)
which is probably a totally wrong way of doing things but worked
for me both in the section title and in the table of contents.
Older, no wiser but somewhat lazier I nowadays avoid math notation
in document and section titles like the plague.
Regards,
Harri
[...]
> In the end, I ended up faking it with something like
>
> \section{Attempts to Improve \protect\(
> \mbox {\em R}_{\mbox {\scriptsize \em k}}\protect \)(3)
>
> which is probably a totally wrong way of doing things but worked
> for me both in the section title and in the table of contents.
Hmmm... tangentially, classes like beamer do manage to fake
mathematics, so ummm... maybe one could look how they do it in one's
copious amounts of spare time... aaaah: sansmath.sty. Seems like I
should rather tweak my texdoc paths in my spare time ;-)
Ulrich
--
∀x∈ℕ or \forall x\in \mathbb{N}?
http://talcum.sarovar.org/ (Current release: 0.5.0 20050306)
jimmij> Hi, I'm trying to redefine \section just like in:
jimmij> ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
jimmij> (section 22.1 on page 47)
[...]
jimmij> Any suggestion is welcome, jimmij -- I come from the Land Of
jimmij> Imagination
I am no real TeX/LaTeX expert, so take what follows with a grain of
salt. I use for my papers the following definition, which I found some
time ago on the web or on Usenet, just before \begin{document}:
\makeatletter
\DeclareRobustCommand\bfseries{%
\not@math@alphabet\bfseries\mathbf
\fontseries\bfdefault\selectfont\boldmath}%
\makeatother
Using teTex 2.0 on Linux, this will convert math to bold in section
titles, at least for the article class. It will convert math to bold
actually whenever math is located where text would be bold.
Greetings,
Alberto
beware of \chapter* -- you may not do it but a lot of things (like
table of contents) do, and it won't work with the above.
we had discussions about \chapter* and so on, not long back, here.