Change font in caption/headings textAdd tags
6 posts
• Page 1 of 1
Change font in caption/headings textHi,
I have a document where I use a specific definition to put a specific word always in another font: i.e.: \usepackage[T1]{fontenc} \def\bubu{{\renewcommand{\rmdefault}{pfu}\textrm{bubu}}} I then use \bubu in the body text to get the word bubu in the preferred font. This works fine, but it doesn't work in headings and captions. I didn't found any hints on the web how to resolve this problem without changing the font of the whole caption/heading. To be clear, I want to have something like this: \begin{figure} \caption{Normal text, normal text, \bubu in other font, normal font again} \end{figure} Many thanks in advance for any hints regarding the problem.
Re: Change font in caption/headings textUse \DeclareRobustCommand\bubu instead of \def\bubu.
As an alternative, you could use \protect\bubu instead of \bubu where no fragile commands are allowed, i.e. inside captions and headings. See also: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect http://www.ics.uci.edu/~pan/documents/l ... agile.html Axel
Re: Change font in caption/headings texta bit shorter:
The \xspace from the xspace package allows you to write A \bubu B instead of A \bubu\ B.
Re: Change font in caption/headings textMany thanks it works fine! But if I use the new command in a section or subsection title
the text is printed in the default font. In the table of contents however the font of the subsection titles are printed in the correct font, but in the real document the default font is used. The font of the section title however are also printed in the default font in the toc.
Re: Change font in caption/headings textCould you please provide an MWE? I tested this code (using Times) and it worked everywhere:
Re: Change font in caption/headings textOh, I found my error. Your test file totally works fine.
I had a faulty bold version of my used font. Sorry for the inconvenience and many thanks for the fast help ...
6 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 7 guests |





