Consider the following code:



This is some regular text

\texttt{This is some monospace text}

If I compile this with pdflatex then the result is as expected: the regular text is in the Libertine font, and the monospace text is in the Bera Mono font.

If I compile this with lualatex then the monospace text is in the default (Computer Modern?) font. I expected it to be the same as pdflatex's output.

enter image description here

I have tried passing [mono=false] option to the libertine package, but it makes no difference.

How do I fix this?

  • the libertine package detects luatex and then loads fontspec which changes the encoding from T1 to TU (the encoding recommended for unicode engines). beramono doesn't support this encoding. Remove the fontenc line, and use \setmonofont{DejaVu Sans Mono} to setup the mono font, see e.g. tex.stackexchange.com/a/443235/2388 Feb 14 at 9:03

1 Answer 1


If you are happy to switch to lualatex then you probably should use fontspec explicitly. I've installed Bitstream Vera and Libertine on my Mac, and this is how I would use them to get the combination the OP wants:


% \usepackage[T1]{fontenc}
% \usepackage{libertine}
% \usepackage{beramono}

\setmainfont{Linux Libertine O}
\setsansfont{Bitstream Vera Sans}[Scale=MatchLowercase]
\setmonofont{Bitstream Vera Sans Mono}[Scale=MatchLowercase]

This is some regular text.  \textsf{Sans text}.

\texttt{This is some monospace text}

The names I have used for the fonts are the names that appear in FontBook.app after I have installed them. The Scale parameter helps to make the families look consistent.

Compiling the example above with lualatex produces this:

enter image description here

You must log in to answer this question.

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