# Tag Info

2

There is no Euro symbol in the standard fonts, so textcomp is required. However, the glyph in the European Modern fonts is ugly and wrong; with Latin Modern it's better. \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{textcomp} \begin{document} \begin{verbatim} fr_FR: 123 456,78 € de_DE: ...

9

(it seems this works everywhere apart from acrobat reader) This is based on the example by @DavidCarlisle. The cmtt visible space character seems to be labelled differently in different cmtt variants. For cm-super (which is loaded here when I use \usepackage[T1]{fontenc}), the respective character is named uni2423 which seems to cause problems with evince ...

6

Just define a new environment. The simplest way is with the verbatim package: \documentclass{article} \usepackage{verbatim} \newenvironment{inverb} {\par\addvspace{\topsep}\noindent\textbf{In verbatim}\nopagebreak \verbatim} {\endverbatim} \begin{document} Something before \begin{inverb} some text \end{inverb} Something after \end{document} With ...

5

Geoffrey Poore develops minted further and answered in this similar tex.SE Question: This is not supported in the current release (minted 1.7). There is a \mintinline command in the development version at https://github.com/gpoore/minted. The development version is currently at 2.0-alpha2, but based on my own use and reports from others, it should be ...

4

The verbatim package has an internal interface that allows one to do this. One has to redefine \verbatim@processline, adding an \hspace command at its start: \documentclass{article} \usepackage{verbatim} \newlength\myverbindent \setlength\myverbindent{1in} % change this to change indentation \makeatletter \def\verbatim@processline{% ...

2

As long as your verbatim block doesn't span a page break, you can use the verbatimbox package. The verbbox environment puts the verbatim into a box that can be recalled with \theverbbox. The [t] option makes sure the box is strutted, to give the proper vertical spacing from the previous line. \documentclass{article} \usepackage{verbatimbox} ...

5

verbatim like most LaTeX display environments is a list environment, and one of the main reasons for that is so that they do the right thing when nested in other display environment such as quote (or a similar custom environment with different indentation). \documentclass{article} \begin{document} X\dotfill X\\ X\dotfill X \begin{verbatim} %  @@@ ...

10

The package fancyvrb has the enhanced Verbatim environment, and the key xleftmargin: \documentclass{article} \usepackage{fancyvrb} \begin{document} \thispagestyle{empty} \noindent A non-verbatim line \begin{Verbatim}[xleftmargin=.5in] Some verbatim lines \end{Verbatim} \noindent Another line \end{document} Moreover, you can redefine the standard ...

7

The following doesn't work in evince, see the discussion in comments below As noted in comments I suspect using colour is the most reliable way: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{color} \begin{document}\showoutput \makeatletter \def\@xobeysp{\textcolor{white}{\char32}} \makeatother \begin{verbatim} def myfunction(x): return x ...

6

You have to issue \theverbbox in order to print the verbatim text. However, the verbbox environment shouldn't be inside center. I also add how to do it with fancyvrb and its BVerbatim environment. I also use \url for the URL. \documentclass{article} \usepackage{verbatimbox,fancyvrb,url} \usepackage{amsmath} \begin{document} The table at ...

8

listings offers these commands: \lstinline -- for code snippets (similar to \verb but can highlight code) \lstlisting -- Environment where you can put your code in display mode. \lstinputlisting -- for including standalone files. Here is an example: \documentclass{article} \usepackage{filecontents} \begin{filecontents*}{filename.java} public class ...

2

Use: \setuptype[style={\switchtobodyfont[6pt,tt]}] Also see the excellent article on the ConTeXt wiki on style alternatives

0

Also, take a look at listings and lstautogobble.

4

If you don't need any further formatting of the verbatim stuff you can use the package moreverb or fancyvrb. The provided environment verbatimtab by moreverb has an optional argument to specify the width of a tab. The package fancyvrb provides the option tabsize to speficy the width. \documentclass{article} \usepackage{verbatim,moreverb,fancyvrb} ...

6

Verbatim environments are very special, and generally resist being the arguments of macros, which is effectively what you are doing when you try to put a verbatim environment inside another environment definition. For more details on this problem, see the UK TeX FAQ entry on the topic. Instead, what you can do is hook into the beginning of the verbatim or ...

1

My current best effort at this is based on the concept by @Gilles at Unix SE. It is not a pure *TeX implementation, and it is not perfect, but it is the one that has allowed me to compress my first 1.4MB of text onto 36 pages: around 40kB and 1400 lines per page. I use perl to pre-process the input text to escape LaTeX special characters, and also add ...

5

As you have already used, verbatim package is easy to configure to get proper line breaking and escape all the special characters. For CJK text, xeCJK is your friend. And there are some options of xeCJK to control the behavior for verbatim CJK text. I hacked into xeCJK package to tune the linebreak. It seems better, but not perfect. % -*- coding: utf-8 ...

5


0

If it may be ad hoc solution, the following works: \documentclass{article} \usepackage{fancyvrb} \begin{document} \def\m#1{\global\catcode`\_=8$#1$} \begin{Verbatim}[commandchars=\\\{\}] for \m{i = 1, 2, \dots n}: sample \m{x_i} from \m{P(X_i \vert \mathrm{Parents}(X_i))} return \m{(x_1, x_2, \dots, x_n)} \end{Verbatim} \end{document} ...

Top 50 recent answers are included