19

My title is bold and sans-serif right now but two words in the title have to be italic in addition (scientific name of bacterium). Currently I'm using \selectfont to make the whole thing sans serif but when I try \textit for that name it does not work.

So, in the end it should look like this:

Bla bla bla bla P. aeruginosa

5
  • Use a sans serif font family which has a bold-italic. If I should guess: Add \usepackage[T1]{fontenc}. Apr 5, 2016 at 10:16
  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Rmano
    Apr 5, 2016 at 10:21
  • You can check if a font supports certain variants in the LaTeX Font Catalogue Apr 5, 2016 at 10:26
  • 2
    If one of the answers answered your question, please click the little check mark under the up- and downvote buttons to mark it as accepted.
    – anon
    Apr 5, 2016 at 18:19
  • Really need a MWE, because as noted in the below answers there is no "one size fits all" solution.
    – A Feldman
    Apr 5, 2016 at 19:07

3 Answers 3

34

Your issue is "font-dependent".

Background

Indeed, special shapes of a font (bold, italic, slanted, small caps) are not defined relatively to a main font (its regular shape), but independently. The "bold version" of a font is defined per se (it is an independent *otf, *.ttf-file you can install and use, even if you don't have the main/regular version), and not as an homothetic transformation of the main font.

This is why we often refer to a font-family, that is the different shapes of a font (i.e. regular ("main font"), bold, italic, slanted, bold+italic, bold+slanted, small-caps, etc. versions). Some font-families have a lot of versions/shapes (e.g. not only bold, but also semi-bold), some others only one (there is no bold nor italic versions).

To be complete, a font-family has only shapes variations. Yet neither serif, nor sans-serif are shapes - they are characteristic of a font-family. A font-family is thus either serif, or sans-serif (or mono-spaced, etc.). Over font-families, there are thus font-harmonies, that are a selection of one serif font-family, one sans-serif font family, one mono-spaced ("typewriter") font-family, etc. that goes well the one with the other.

Answer

So the output produce depends on the font-family (thus the font-harmony) used by LaTeX during the compilation: if the bold+{italic/slanted} version of the sans-serif font-family is not installed on your computer (often because it doesn't exist), you cannot achieve what you want.

By default, LaTeX uses the Computer Modern font-harmony. Its sans-serif font-family doesn't have a bold + {italic/slanted} shape version. So you cannot get what you want.

\documentclass{article}

\begin{document}
    Some normal text. 
    \textsf{\textbf{Blah blah \emph{P. aeruginosa}}}

    Some normal text. 
    \textsf{\textbf{Blah blah \textit{P. aeruginosa}}}

     Some normal text. 
    \textsf{\textbf{Blah blah \textsl{P. aeruginosa}}}
\end{document}

enter image description here

However, when you load e.g. the lmodern-package, you tell LaTeX to use the Latin Modern font-harmony. Since its sans-serif font-family has a bold+italic and a bold+slanted version, it can produce the output you want.

\documentclass{article}
    \usepackage{lmodern}
\begin{document}
    Some normal text. 
    \textsf{\textbf{Blah blah \emph{P. aeruginosa}}}

    Some normal text. 
    \textsf{\textbf{Blah blah \textit{P. aeruginosa}}}

     Some normal text. 
    \textsf{\textbf{Blah blah \textsl{P. aeruginosa}}}
\end{document}

enter image description here

9
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\begin{document}
\textsf{Bla bla \textit{P. aeruginosa}} \par
\textbf{\textsf{Bla bla \textit{P. aeruginosa}}}
\end{document}

enter image description here

1
  • Thanks! I tried first the other answer \usepackage{lmodern}, which did not helped me. This fixed me problem
    – Cohensius
    Jul 19, 2020 at 11:13
2

In a nutshell: \textsf and \textbf and \textit (and virtually as many others as you wish) can be nested without problem.

The issue here is in the font file. It should provide the adequate style for all the combined shapes that you want. That is not always the case (especially with cheap fonts or badly designed fonts that one finds on the net).

In general, you had better use well-designed, standard, common, classic fonts (Computer Modern, Times, Helvetica, Baskerville, Garamond...) over some rare and unknown fonts that might look fancy, but could lack such precious features as BoldItalic or many others.

1
  • Note that the Garamond available through the ebgaramond package does not have a bold weight. For a highly similar font with bold weights, use the Free Bembo font through fbb. Apr 5, 2016 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .