2
votes
1answer
68 views

Difference between fixed-width and proportional typewriter fonts in listings?

In the MWE below, I wonder why does the pcr (Courier) font align in both escaped and unescaped versions and for whatever column setting of {listing} - while the cmtt (Computer Modern Teletype) aligns ...
1
vote
1answer
59 views

Using mathastext with listing

In the following example code, I would like to use mathastext so as to use the same font than the one used by listings. In the code above, the output of the listing do not use a courier-like font, ...
2
votes
1answer
79 views

Condensed comment font in listings

I'm trying to condense the size of my comments by using a condensed font however its not working correctly. The font shape looks fine with ttfamily enabled in basicstyle, however, there is a huge ...
2
votes
1answer
44 views

texcl option to listing package's lstset - not working in block comments

I am using the listings package to typeset code listings. I am further using the texcl option in my \lstset (\lstset{texcl}) so that I can write TeX code, including math, in comments. However, this ...
1
vote
0answers
65 views

How to include program listings in C# with custom font and syntax highlighting in LyX?

I'm rather new to LaTeX and use LyX editor to create my documents. There are similar questions but none of them answer how to do that in LyX. I am wondering, how to include a program listing in ...
4
votes
2answers
122 views

What is the least invasive way to set the font for listings?

As has been asked often enough, to get bold keywords in lstlisting environments, one has to use a different typewriter font. Most answers suggest to include this or that package. If just including a ...
4
votes
2answers
216 views

Setting up `Ubuntu Monospace` font for a specific listing

My OS : Ubuntu 13.10 Latex version used : Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) In my report, I am using the following listing : \lstdefinestyle{BashInputStyle}{ language=bash, ...
6
votes
1answer
708 views

LaTeX commands in Verbatim using fancyvrb and listings

I am trying to use LaTeX commands like \textbf, \textit, \textcolor in fancyvrb combined with listings. Especially I want to bold and color any text or entire blocks of Java code (not just keywords) ...
5
votes
1answer
72 views

Font for inline Listings is not changing

I am writing my thesis in LaTeX and use \lstinline{} a lot. The problem is that the font on the output does not change to 'this', but rather continue like 'this'. How do I correct this behaviour? I ...
1
vote
0answers
359 views

Change font style for \texttt [closed]

I am afraid if this is a repeat question. I have checked the following links for any hints: Change font size of \texttt globally? Using same font for \texttt and \Verb The question is simply. I ...
4
votes
1answer
217 views

How to avoid double dash seem as a continuous line?

I'm using listings to show some source code (bash scripts) in my document but there is a problem, when using mono spaced fonts, the space between dashes is very small and in the printed document two ...
0
votes
1answer
84 views

saner listings monospace font size relative to surrounding text size [duplicate]

Is it possible to make listings and especially inline listings font size to be saner? It appears that the font size is chosen so that capital letters of the monospace font are full height of a line. ...
5
votes
1answer
165 views

Problem with listings package using stix fonts

Consider the following code: \documentclass{article} \usepackage{stix} \usepackage{listings,xcolor} \lstdefinelanguage{test}{sensitive=true, morekeywords={TEST}, morecomment=[l]{--}} ...
6
votes
4answers
485 views

Is it possible to use a non-monospace font in verbatim environments?

I know it runs contrary to a lot of the point, but I'd like to experiment with different fonts to see which I like better. I can't seem to find any reference to a way to do this, if it's at all ...
3
votes
1answer
253 views

verbments (listings alternative) and UTF-8

This is a follow-up question to UTF8 for listings With these MWE I will not see the german umlauts in the resulted pdf (XeLaTeX was used): \documentclass{article} \usepackage{verbments} ...
9
votes
1answer
553 views

UTF8 for listings

With German umlauts I have to define these characters (Typesetting UTF8 listings with German Umlaute) and the following MWE is working: \documentclass{article} \usepackage[utf8]{inputenc} ...
6
votes
2answers
585 views

Listing with mixed english and russian symbols in comments

I'm using the listings package for formatting .cpp code in LaTeX. My code needs to have mixed English and Russian words in comments. The font must be monospaced (preffered Courier family). /* Prints ...
3
votes
1answer
193 views

Use pxfonts in listings only

I really like the pxfont package for displaying code in listings. I would usually just do this to load pxfont for the entire document; \usepackage{pxfonts}. However, this time I am required to use a ...
1
vote
1answer
218 views

lstlisting: how to align highlighted code

I want to define a couple of new commands in order to highlight parts of my code (this is actually for a trace dump, not for a programming language). My problem is that I can't seem to make the ...
4
votes
1answer
688 views

Default value for basicstyle in lstlisting

I have most of the code in Python, which renders very nice with this simple configuration of lstlisting At a certain point I have to include an XML file, so I switched to language=XML but it renders ...
2
votes
2answers
2k views

\ttfamily is too bold for me

I use the following settings for my listings: \lstset{ %basicstyle=\ttfamily\tiny, % small basicstyle=\ttfamily\scriptsize, % middle } But the font in the listings is too bold for me. I tried a ...
3
votes
1answer
277 views

Moving from fancyvrb to listing – need to reconstruct my font settings

I have happily used the fancyvrb package with the Verbatim environment so far, but I want to change my figures to use the listing package with the lstlisting environment in order to have bold-faced ...
6
votes
1answer
584 views

change code font using mcode package

I'm using mcode package to insert into my document matlab code. I would change the default font. what command I should use to get this font?
5
votes
1answer
291 views

Getting incorrect underscores from macro in an lstlisting

I have a macro that I define as \newcommand{\versionPath}{5\textunderscore0\textunderscore7} to denote the word *5_0_7*, which I use in lstlisting's like this: \begin{lstlisting} ...
4
votes
1answer
955 views

Change in \lstdefinelanguage the font?

Im using \lstdefinelanguage to add some new languages. Now everything is fine, I just would like to add another font to my language. I would like to use inconsolata. I have now this: %... ...
6
votes
1answer
159 views

Is it possible to change the font of line numbers in a code listing?

Using LyX I can add line numbers to my code listing. However, these are in the document (serif/Roman) font and look strange next to code blocks (Typewriter font). Is it possible to change the font of ...
7
votes
1answer
2k views

Set font in listings in XeLaTeX

I want to set specific font just for listings in XeLaTeX. \newfontfamily\consolas{Consolas} \lstdefinelanguage{MyLanguage}{ basicstyle=\ttfamily, .... % my language definition } ...
3
votes
2answers
2k views

Lyx is ignoring typewriter font setting for program listings

I'm using Lyx's Insert|Program Listing to insert a code listing into my document. Unfortunately, Lyx seems to ignore the Typewriter font selection I made in DocumentOptions under Fonts ⇒ ...
2
votes
2answers
118 views

A macro that behaves like a font-changing command (affects the rest of the current group)

Many LaTeX packages provide an interface to modify the typesetting of certain elements with the standard "parameterless" font commands, such as \bfseries, \sffamily or \color{red}. All of these ...
7
votes
3answers
782 views

Best way to write an xml tag

I'm writing a document about an XML schema, and I will be talking a lot of times about that <tag1> or that other <tag2>. Since I'm only mentioning them and not printing a whole XML file, ...
9
votes
2answers
6k views

Setting up specific font for use in listings

I'm writing my dissertion using TeX. I would like to use a specific font in my lstlisting source code. How can I use a specific font like Monaco or Arial? I usually found solutions with basicstyle ...
11
votes
2answers
20k views

set the font family for lstlisting

I have the following set up for my listings : \lstset{basicstyle=\footnotesize,breaklines=true} \lstset{framextopmargin=50pt,frame=bottomline} I would like to change the font family to Courier. ...
5
votes
2answers
808 views

How can I tell lstlisting to use sans-serif when escaping to math mode?

Title says it all, an example follows: \lstset{ mathescape=true, basicstyle = \sffamily } \begin{lstlisting} func($x_0$) \end{lstlisting} Where and how can I set the math font used ...
2
votes
1answer
8k views

Adding C++ code in Latex

So I am adding some C++ code snippets in my document using \lstset {language=C++} \begin{lstlisting} for (int i=0; i<iterations;i++) { do something } \end{lstlisting} My issue is that the font ...
4
votes
2answers
6k views

How to change the font style and size for the \lstinputlisting

I am trying to insert some piece of code into my document, using the \lstinputlisting command. However the fonts displayed do not look too good. Is it possible to change the font size and style?
5
votes
2answers
1k views

Fixed Width Font with LTXexample environment

Not sure why this problem has eluded me but I can't seem to get fixed width font in the code portion. I thought that this question on how to change code font would do the trick but it doesn't for me. ...
11
votes
1answer
6k views

How to change code example font in listings?

Does anyone know how to change the font for code snippets in the listings package? I'd like to have a constant width font, rather the fancy variable-width looking font that it has by default.
4
votes
1answer
917 views

lstlistoflistings font

I'd like to change my list of listings to match my list of figures, which I have changed using tocloft: \renewcommand{\cftfigfont}{\sffamily\mdseries\upshape} Is there a way to do the same with my ...
1
vote
1answer
3k views

change font color in a lstset [closed]

Hi I need put java code to latex. I use \lstset and \begin{lstlisting}. I need change color of font in SOME part of code. How I can do this? Help pls