133

I can't seem to have both the small caps and boldface styles on a line:

\huge\sc\bf Hello

This will generate bold text, and if the \sc is placed after, it will generate small caps text but not bolded. They seem to override each other, so is there any way to apply them both?

migrated from stackoverflow.com Sep 4 '11 at 2:57

This question came from our site for professional and enthusiast programmers.

156

Your question requires a two-part answer.

\sc and \bf (and \it) are deprecated because, as you have noticed, they override each other. Use either

\textit{...}
\textbf{...}
\textsc{...}

or

{\itshape ...}
{\bfseries ...}
{\scshape ...}

instead.

However, not all fonts contain italic and/or bold small caps (when they even contain small caps).

(Also, italic and small caps usually don't combine at all by default, requiring \usepackage{slantsc} to do so.)

When you load the T1 font encoding, you're replacing the default Computer Modern fonts by CM-Super, a larger but lower-quality set of fonts that look mostly identical but contain many more glyphs. In older TeX distributions, you might even end up with bitmap fonts in your output.

The Latin Modern fonts are a better alternative (\usepackage{lmodern}), but they unfortunately don't contain bold small caps.

  • 7
    "In older TeX distributions, you might even end up with bitmap fonts in your output." - or the \textsc is just ignored and the \textbf{\textsc{...-text it printed in bold, because there is no appropriate font available and neither can it be created on the fly. – Stephen Dec 9 '11 at 18:36
  • 1
    Can you explain why you call the CM-Super font "lower quality"? I always use the T1 encoding in order to be able to correctly copy-paste umlauts (for example) from my documents. Is there an explanation somewhere of the difference between the two? – Fritz Sep 14 '14 at 12:06
  • 1
    I can't find the TUG article that discusses it explicitly (I thought there was one in the last few years), but Cm-Super, I believe, is generated more automatically; in particular, I seem to recall that its auto tracing method produced outlines that are more complex than they need to be (i.e., fonts are larger) but also not as representative of the original CM bitmaps. – Will Robertson Sep 15 '14 at 4:29
41

For posterity, there is an easier and better alternative. Simply add

\usepackage{bold-extra}

along with your other includes. This lets you keep using the default high-quality Computer Modern fonts for normal text. It works by building a bold Computer Modern small-caps font on the fly and including it for you. Now \bfseries{\scshape{Foo}} works as expected!

Reference: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=bold-extras

  • 6
    from my own experiments, I would contest the claim that this method keeps "using the default high-quality Computer Modern fonts." My bold small caps appear pixelated if I use the bold-extra package. – arturomp Jan 22 '12 at 20:19
  • @amp sure -- the cm bold sc, etc, fonts are contributed extra metafont snippets. no-one seems to have traced them. – wasteofspace Mar 7 '12 at 13:22
  • 7
    Just a note for readers, \bfseries and \scshape do not take arguments; more appropriate syntax for the example would be {\bfseries{\scshape Foo}} or simply {\bfseries\scshape Foo}, but the argument variants are often preferred: \textbf{\textsc{Foo}}. – Sean Allred Jan 8 '14 at 1:34
  • @arturomp Did you combine this with \usepackage[T1]{fontenc}? Gives non-pixelated bold small caps for me. – Ruben Verborgh May 4 '15 at 16:25
18

Ok, you need to add

\usepackage[T1]{fontenc}

and this updated command should do the trick

\huge \textbf{\textsc{Hello}}

To explain, LaTeX uses the curly braces {} to indicate scope for the formatting command. So if you type

\textbf{ ... }

then all the text between the curly braces is formatted in bold, including the

\textsc{Hello}

Result

Small Caps Bold

Small Caps Bold

compared to regular small caps

small caps regular

  • 7
    It doesn't seem to work. The text is only in bold. Also, I think that's the same as my statement since the braces are implied. – verhogen Mar 30 '09 at 23:10
  • 2
    pay close attention to the order of the braces and the commands. Works for me. – Azim Mar 30 '09 at 23:15
  • 2
    ok, my eyes tricked me sorry. you are correct. it doesn't work :( – Azim Mar 30 '09 at 23:23
  • ok, actually I had the [T1], I think the problem was actually my PDF viewer... – verhogen Mar 31 '09 at 4:00
  • 2
    The lmodern package prevents the good functioning of "bold" + "small caps". Is that possible ? – SDrolet Mar 31 '14 at 0:20
10

A rather crude way of obtaining bold-like characters from a font that doesn't have it, is to repeatedly overprint a character with slight variations. This is offered by the contour package:

enter image description here

\documentclass{article}
\usepackage{contour}% http://ctan.org/pkg/contour
\setlength{\parindent}{0pt}% Just for this example
\begin{document}

% Default
Hello

% Bold
\textbf{Hello}

% Small-caps
\textsc{Hello}

% Combined
\textbf{\textsc{Hello}}

% Default \contourlength (0.03em)
\contour{black}{\textsc{Hello}}

\contourlength{0.01em}% Smaller radius
\contour{black}{\textsc{Hello}}

\contour*{black}{\textsc{Hello}}% 32 copies (default is 16)

\contour[100]{black}{\textsc{Hello}}% 100 copies

% Just for reference
\contourlength{0.05em}
\contour[5]{red}{\textsc{Hello}}

\end{document}
  • 1
    It's worth noting that this method generalises to awkward situations, e.g. where you don't want to (or can't) use font substitution to obtain the same effect. – Landak Sep 19 '15 at 12:49
6

For many years, because I rarely need it, I have used the following hack:

\textbf{\normalsize{E}\scriptsize{ITHER} \normalsize{O}\scriptsize{NE} \normalsize{B}\scriptsize{UT} \normalsize{N}\scriptsize{OT} \normalsize{B}\scriptsize{OTH}}

which gives

enter image description here

But I wish there were a better way.

  • @cfr I will not discuss the value of your edit but now my sentence, namelyI have used the following hack, is FALSE as, for the better of for the worse, this is NOT the hack I have used. I don't think that's appropriate. Why couldn't you write it as your answer? – schremmer Aug 25 '17 at 14:27
  • 1
    Your code was wrong: font switches don't take arguments. \scriptsize{a} \scriptsize{b} c d is just \scriptsize a b c d. The {} aren't part of the macro syntax. They are just regular TeX grouping characters. But people see this kind of bad code and they expect that \scriptsize{a} b will not put b in \scriptsize. I didn't change your hack. It is the same hack. I just corrected the use of NFSS implementing the hack. I'm certainly not going to write an answer suggesting your hack, since I think it is horrible to do this. It is still the same (horrible) hack. But it doesn't abuse NFSS. – cfr Aug 25 '17 at 23:00
  • @cfr 1. I said it was a hack. As such it works and I made no other claim. In fact, I wrote "I wish there were a better way". 2. I can see why you're "certainly not going to write an answer suggesting[my] hack, since [you] think it is horrible to do this" 3. What I can't see is what prevented you, instead of editing my code, from writing in a comment what you just said above. Or from explaining your edit as above. (All being clear, I wouldn't have objected.) 4. There is no going around the fact that your edit resulted in code standing under my name which I did NOT write. – schremmer Aug 28 '17 at 1:09
  • That is pretty much how SE works. The history shows that I edited it and, indeed, precisely what I did. I want to offend you, but if you don't want your code edited regardless, you really shouldn't post it on this site. As I say, it is still your hack. It just uses NFSS correctly. I took that to be inessential to your hack, which I left unchanged. That is, I did not significantly alter your intended meaning, just corrected a common mistake which was incidental to it. – cfr Aug 28 '17 at 2:27
  • I've rolled it back and flagged the discussion. Note that I've rolled back my edit but not the previous edit, which was not mine, as you seem to object only to the changes I made, for reasons I'm not entirely sure of. I didn't mean to offend you or start an argument. I think correcting the use of NFSS improves the post. I wouldn't do this because I am generally opposed to faking font variants (small-caps, bold etc.) generally. I think it better to pick a font with the features you need. I don't have any objection to your hackery in particular, by any means. – cfr Aug 28 '17 at 2:37
4

As an extension of accepted answer https://tex.stackexchange.com/a/27413/1340, I explain here how to use Latin Modern while taking serif bold small capitals from Computer Modern (= CM) Super. As explained in that answer, you'll still need to use \textsc{\textbf{Hello}} instead of \sc\bf Hello. This assumes you're using \usepackage[T1]{fontenc} as typically recommended nowadays. The solution is inspired from an aside in question How te get bold + small caps with latin modern or computer modern.

First, to obtain a "fixed" version of CM Super, add

\RequirePackage{fix-cm}

before \documentclass. After \documentclass add the following commands (with or without comments):

\usepackage[T1]{fontenc} % To switch to the T1 encoding
\usepackage{lmodern} % To switch to Latin Modern
\rmfamily % To load Latin Modern Roman and enable the following NFSS declarations.
% Declare that Latin Modern Roman (lmr) should take
% its bold (b) and bold extended (bx) weight, and small capital (sc) shape, 
% from the corresponding Computer Modern Roman (cmr) font, for the T1 font encoding.
\DeclareFontShape{T1}{lmr}{b}{sc}{<->ssub*cmr/bx/sc}{}
\DeclareFontShape{T1}{lmr}{bx}{sc}{<->ssub*cmr/bx/sc}{}

The resulting output has working bold small capitals in Type 1 format (tested with pdflatex).

  • 1
    Excellent answer, thank you. I could't just use \usepackage[T1]{fontenc} for bold small caps because I also needed bold teletype provide by \usepackage{lmodern} for my code listings, but your solution provides both! – Brian Hempel Feb 9 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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