3

This is a follow-up to the question Change from old style numbers to lining numbers in lineno's linenumbers environment

I've discovered that the suggestion given there doesn't target the line number that gets printed in the margin next to section headings. They are still being printed with old style numbers. How can I make these appear as lining numbers as well?

\documentclass{article}
\usepackage{lipsum,fontspec,lineno}
    \setmainfont[Numbers=OldStyle]{Linux Libertine O}
    \renewcommand\linenumberfont{\scriptsize\addfontfeatures{Numbers=Lining}}

\begin{document}
    \begin{linenumbers}
        \section{My first section}
            \lipsum[1]
        \section{My second section}
            \lipsum[2]
    \end{linenumbers}
\end{document}

enter image description here

1 Answer 1

4

You can simply add \normalfont in

\renewcommand\linenumberfont{\scriptsize\addfontfeatures{Numbers=Lining}}

so to have

\renewcommand\linenumberfont{\normalfont\scriptsize\addfontfeatures{Numbers=Lining}}

Complete MWE

\documentclass{article}
\usepackage{lipsum,fontspec,lineno}
    \setmainfont[Numbers=OldStyle]{Linux Libertine O}
    \renewcommand\linenumberfont{\normalfont\scriptsize\addfontfeatures{Numbers=Lining}}
\begin{document}
    \begin{linenumbers}
        \section{My first section}
            \lipsum[1]
        \section{My second section}
            \lipsum[2]
    \end{linenumbers}
\end{document} 

Output

enter image description here

Of course, you won't have bold line numbers for titles, but this is the default behavior for line numbers...

1
  • I agree. No need to have bold line numbers next to headings anyway.
    – Sverre
    Oct 3, 2013 at 15:43

You must log in to answer this question.

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