1

I am writing a document using lmodern package and I need to redefine all sections in order to be bolded and in small caps. I cannot change the lmodern font for another one including bold small caps and tricks like

\usepackage{lmodern}
\usepackage{fontspec}
\usepackage[T1]{fontenc}

{\fontfamily{cmr}\textsc{\textbf{Hello World}}}

do not seem to work in Lualatex when I define:

\titleformat{\section}[hang]{\centering\fontfamily{cmr}\large\textsc\textbf}{\Roman{section}.}{2ex}{}[]

Is there a way to make all sections bolded and small caps while keeping lmodern package for the rest of the document?

0

2 Answers 2

1

The lmodern package isn't compatible with fontspec. And lmodern isn't really compatible with LuaLaTeX anyway.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}

Straße

Wrocław

\end{document}

Compile with LuaLaTeX to get

enter image description here

However, if you remove lmodern and fontenc, you don't get boldface small caps, because this combination is not available in Latin Modern fonts.

\documentclass{article}

\begin{document}

Straße Wrocław

\textbf{\textsc{Abc}}

\end{document}

Now the first words are typeset as intended, but there's no boldface small caps.

enter image description here

You can use New Computer Modern instead, that's essentially indistinguishable from Latin Modern.

\documentclass{article}
\usepackage{fontsetup}
\usepackage{titlesec}

\titleformat{\section}[hang]
  {\filcenter\large\scshape\bfseries}
  {\Roman{section}.}
  {1em}
  {}

\begin{document}

\section{Straße Wrocław}

\textbf{\textsc{Abc}}

\end{document}

enter image description here

1

You don't need the lmodern package as Latin Modern is the default lualatex font. It doesn't have bold small caps, but you could define a font family for Computer Modern Unicode, and use that where you need smallcaps.

You should also never use \usepackage[T1]{fontenc} with lualatex.

enter image description here

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\cmu{CMU Serif}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\cmu\Large\bfseries\scshape}}
                                         %%%%%%                 %%%%%%%%%%x

\makeatother
\begin{document}

{\cmu \textsc{Abc Def} \textsc{\bfseries Abc Def}}

\section{Caps and Small Caps}
xxx

\end{document}

You must log in to answer this question.

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