Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to put a \texttt{} block in a section, e.g.

\section{Algorithm \texttt{FSG}}

But the problem of this approach is that the text inside the\texttt{} block does not inherit the size and boldness of the surrounding text, at least with the ACM sig-alternate document class. How could I solve this problem?

share|improve this question
1  
The Computer Modern Typewriter font doesn't have a boldface version; the size, however, is inherited. –  egreg Dec 21 '12 at 17:16
    
How can I specify that a block of text has to be displayed in Computer Modern Typewriter? –  akappa Dec 21 '12 at 17:18
    
Well, if you don't change the font setup, saying \texttt{something} typesets "something" in CM Typewriter. –  egreg Dec 21 '12 at 17:19
    
Oh, I see. Well, I am using ACM's sig-alternate documentclass, but I am not saying a thing about fonts and stuff like that. The size of the typewritten text, however is noticeably smaller than the rest of the section title. –  akappa Dec 21 '12 at 17:22
4  
That's a problem with the sig-alternate class that's written in what I wouldn't define good LaTeX programming. :( –  egreg Dec 21 '12 at 17:27

1 Answer 1

up vote 9 down vote accepted

Unfortunately the sig-alternate class uses a peculiar1 way to set the document fonts.

In particular, the \texttt macro selects the font family aett (which belongs to a definitely obsolete package) at size 9pt, independent of context. So you have two problems.

  1. Use a boldface version of the Typewriter font.

  2. Increase the font size in section titles.

Solution to problem 1

\DeclareRobustCommand{\ttfamily}{\fontencoding{T1}\fontfamily{lmtt}\selectfont}

Solution to problem 2

\DeclareRobustCommand\sectt[1]{{\fontsize{13}{12}\bfseries\ttfamily#1}}

Example document

\documentclass{sig-alternate}

\DeclareRobustCommand{\ttfamily}{\fontfamily{lmtt}\selectfont}
\DeclareRobustCommand\sectt[1]{{\fontsize{13}{12}\bfseries\ttfamily#1}}

\begin{document}

\section{Algorithm \protect\sectt{FSG}}
Algorithm \texttt{FSG}

\end{document}

enter image description here

Newer problems

Due to how the class is written, you won't be able to make a table of contents if a command such as \sectt appears in a section title. But this would happen also with \sqrt and other seemingly innocuous commands

The editors of the conference to which you're submitting the paper may not be happy with these changes.


1 The adjective "peculiar" should be read as "blatantly wrong".

share|improve this answer
    
Fantastic answer. Thank you very much! –  akappa Dec 21 '12 at 18:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.