Tag Info

New answers tagged

2

In addition to specifying the option [fragile] when starting the frame, you will need to issue the command \scriptsize -- for a 30% linear reduction in font size -- in order to make the verbatim material fit in the frame. % !TEX encoding = UTF-8 Unicode \documentclass{beamer} \mode<presentation> \usetheme{Madrid} \setbeamercovered{transparent} ...


2

What you probably want is actually the "verbatim" environment. http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/PreFormatted.html \documentclass{article} \begin{document} \begin{verbatim} Preformatted Text Here \end{verbatim} \end{document} This compiles to:


3

For printing file names you don't need \verb, just that the underscore becomes printable. \documentclass{article} \usepackage{amsmath,array,booktabs} \begin{document} \begin{tabular}{ >{\ttfamily\catcode`_=12 }l l } % Chap2.nb & notebook \\ PI_all_data_BBB_M15X.pdf & Results for \texttt{BBB} model with profile plots \\ ...


2

Use collcell to collect the cell contents, and then parse it \detokenized: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{array,collcell} \newcommand{\myverb}[1]{\ttfamily\detokenize{#1}} \begin{document} \begin{tabular}{ >{\collectcell\myverb}l<{\endcollectcell} l } PI_all_data_BBB_M15X.pdf & Results for \verb=BBB= model ...


2

Besides \let\arabicfonttt\ttfamily you have to do \setmonofont{DejaVu Sans Mono} or any other monospaced font supporting Arabic. \documentclass[12pt,a4paper]{article} \usepackage{polyglossia} \setmainlanguage[numerals=maghrib]{arabic} \setotherlanguage{english} \newfontfamily\arabicfont[Script=Arabic,Scale=1.2,AutoFakeSlant=-0.02]{Traditional Arabic} ...


1

Per the OP's request, I am turning my comments into an answer. When one's LaTeX installation can't locate a package, your only option is to install it yourself. First you have to locate the missing package. A good place to start is the repository at ctan.org. In this case, the readarray package that I wrote is stored there in ...


0

Package varwidth would help, because it can shorten the lines (that would use the full \linewidth otherwise): \documentclass{article} \usepackage{varwidth} \begin{document} \begin{center} hello world \end{center} \begin{center} \begin{varwidth}{\linewidth} \begin{verbatim} def main(): print("hello world") \end{verbatim} \end{varwidth} \end{center} ...


0

I met the same problem when I tried to include the output of the Unix cal command inside a LaTeX macro. Enclosing the cal output within the verbatim environment does not work for reasons cited above. My solution is a hack. Create a LaTeX document (calendar-out.tex) containing only the output of cal and inside a verbatim environment. Convert ...


2

If you are willing to create the verbatim component in advance of the listing, this can be done... If you need more than one verbatim block per listing, the myverbbox environment allows you to give names to the verb-boxes (rather than the default \theverbbox as shown here). \documentclass{article} \usepackage{listings}% http://ctan.org/pkg/listings ...


4

To accommodate for line-breaks inside verbatim, use the verbatim environment: \documentclass{article} \setlength{\parindent}{0pt}% For this example \begin{document} \verb|<TITLE> * </TITLE>| \begin{verbatim} <TITLE> * </TITLE> \end{verbatim} {\ttfamily% <TITLE> * </TITLE> } \end{document} Also see, as reference, ...


1

In the end, I have gone for the simple solution of fiddling with textheight and stuffing a \newpage line on the beginning of every code block which doesn't make it in to the end document! \setlength{\paperheight}{100cm} \setlength{\textheight}{99cm} \ScriptEnv{tawny} {\newpage\IgnorePar\EndP\HCode{<pre><code class="tawny">}\HtmlParOff\NoFonts} ...


1

With inspiration from Egreg's answer to a prevent pagebreak question, I created macro which prevents page break modified .cfg file form your previous question: \Preamble{html} \def\StartSuppressPage{\nobreak\vfil\penalty0\vfilneg\vtop\bgroup} \def\EndSuppressPage{\egroup} \ScriptEnv{tawny} {\IgnorePar\EndP\StartSuppressPage\HCode{<pre><code ...


4

Please post a complete and compilable minimal working example (MWE) with your next question. This reduces the efforts of others to help you, and generally increases your chances to get an answer. The following does what you have asked for. Inside the commands environment, we overwrite the \thelstnumber command, which listings uses internally to typeset the ...


1

You can use \ScriptEnv command to define verbatim environment: \Preamble{html} \ScriptEnv{tawny} {\IgnorePar\EndP\HCode{<pre><code class="clojure">\Hnewline}\EndNoFonts} {\NoFonts \HCode{</code></pre>}} \begin{document} \EndPreamble resulting html: <pre><code class="clojure"> (defclass Pizza :super Thing) ...


2

The \verb command works only if the the argument is not already tokenized. The classical situation this shows up in is that you cannot use \verb in the argument of another command. However, the same problem applies here: to save the input to a macro, the 'caught' information has to be tokenized. That can't work, I'm afraid.


3

As far as I know, tabu doesn't support listings even in the tabu* environment. However, I found that pythontex works: \documentclass[11pt]{article} % use larger type; default would be 10pt \usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX) %%% PAGE DIMENSIONS \usepackage{geometry} % to change the page dimensions \geometry{a4paper} ...


4

This is by no means strange: if I try the simple example \documentclass{article} \begin{document} A\char`\_B \end{document} I get because the standard fonts in OT1 encoding have the dot accent in the slot ASCII reserves for the underscore. Just adding \usepackage[T1]{fontenc} produces because T1 encoded fonts have all the ASCII characters in ...


10

* makes \verb* so can't be used for the non-star form without hacking internals, but apart from that any character may be used, the reason is that you need to choose a character that is not in the string that is being set verbatim. Note that latex doesn't make all symbols safe in verbatim (or for the verb delimiter) If you try to use an ascii null (byte 0) ...



Top 50 recent answers are included