Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XeLaTeX: boldfaced keywords in listings

34 views
Skip to first unread message

Manuel Collado

unread,
Nov 23, 2009, 11:08:24 AM11/23/09
to
Using XeTeX (XeLaTeX) from Miktex 2.7 on Windows XP SP3.

The default fonts used by the listings package make bolfaced keywords
hardly distinguishable from normal text. By the way, I had to specify:

\lstset{..., basicstyle={\ttfamily\small}, ...}

in order to have monospaced text.

Could anybody recommend an adequate font for bolfaced/regular monospaced
text? And tell me how to instruct the listing package to use it?

Looking at the .log file I think the relevant info is:

[8]
LaTeX Font Info: Font shape `EU1/lmtt/bx/n' in size <12> not available
(Font) Font shape `EU1/lmtt/b/n' tried instead on input
line 401.
Requested font "[lmmonolt10-bold]" at 12.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmmonolt10-bold.otf
Requested font "[lmmono10-italic]" at 10.95pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmmono10-italic.otf
...
[27]
Requested font "[lmroman7-regular]:mapping=tex-text" at 7.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmroman7-regular.otf
Requested font "[lmroman5-regular]:mapping=tex-text" at 5.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmroman5-regular.otf
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 1357.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 1357.
Requested font "[lmroman10-italic]:mapping=tex-text" at 10.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmroman10-italic.otf
Requested font "[lmroman7-italic]:mapping=tex-text" at 7.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmroman7-italic.otf
Requested font "[lmroman7-italic]:mapping=tex-text" at 5.0pt
-> I:/prog/MiKTeX-2.7/fonts/opentype/public/lm/lmroman7-italic.otf

But, being only an occasional LaTeX user, it is possible that these
warnings are in fact unrelated to my problem.

Thanks in advance.
--
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado

Alan Munn

unread,
Nov 23, 2009, 12:43:57 PM11/23/09
to
In article <heec93$f6m$1...@heraldo.rediris.es>,
Manuel Collado <m.co...@invalid.domain> wrote:

> Using XeTeX (XeLaTeX) from Miktex 2.7 on Windows XP SP3.
>
> The default fonts used by the listings package make bolfaced keywords
> hardly distinguishable from normal text. By the way, I had to specify:
>
> \lstset{..., basicstyle={\ttfamily\small}, ...}
>
> in order to have monospaced text.
>
> Could anybody recommend an adequate font for bolfaced/regular monospaced
> text? And tell me how to instruct the listing package to use it?
>
> Looking at the .log file I think the relevant info is:

You don't say exactly what you've done, but the following works fine, if
you have the Luxi Mono font installed on your system (as a regular
font). You could substitute Courier or Courier New

Remember that XeLaTex source files need to be saved as UTF-8.

Alan


\documentclass{article}
\usepackage{xltxtra}
\usepackage{listings}
\setmonofont{Luxi Mono}
\begin{document}
\lstset{language=Pascal, basicstyle={\ttfamily\small}}
\begin{lstlisting}
for i:=maxint to 0 do
begin
{ do nothing }
end;
Write(�Case insensitive �);
WritE(�Pascal keywords.�);
\end{lstlisting}

\end{document}

Manuel Collado

unread,
Nov 23, 2009, 2:44:05 PM11/23/09
to
Alan Munn escribi�:

> In article <heec93$f6m$1...@heraldo.rediris.es>,
> Manuel Collado <m.co...@invalid.domain> wrote:
>
>> Using XeTeX (XeLaTeX) from Miktex 2.7 on Windows XP SP3.
>>
>> The default fonts used by the listings package make bolfaced keywords
>> hardly distinguishable from normal text. By the way, I had to specify:
>>
>> \lstset{..., basicstyle={\ttfamily\small}, ...}
>>
>> in order to have monospaced text.
>>
>> Could anybody recommend an adequate font for bolfaced/regular monospaced
>> text? And tell me how to instruct the listing package to use it?
> ...

> You don't say exactly what you've done, but the following works fine, if
> you have the Luxi Mono font installed on your system (as a regular
> font). You could substitute Courier or Courier New
>
> Remember that XeLaTex source files need to be saved as UTF-8.
> ...

> \documentclass{article}
> \usepackage{xltxtra}
> \usepackage{listings}
> \setmonofont{Luxi Mono}
> \begin{document}
> \lstset{language=Pascal, basicstyle={\ttfamily\small}}
> \begin{lstlisting}
> for i:=maxint to 0 do
> begin
> { do nothing }
> end;
> Write(�Case insensitive �);
> WritE(�Pascal keywords.�);
> \end{lstlisting}
>
> \end{document}

Yes. Luxi Mono seems to be Ok (after some scaling)

Thanks, a lot.

0 new messages