Linked Questions

24 votes
3 answers
5k views

In LuaLaTeX, how do I pass the content of an environment to Lua verbatim?

In LuaLaTeX, how would I go about capturing the content of an environment for (verbatim) processing by Lua? For example, consider something like \begin{foobar} Hello {World} \end{foobar} I'd like ...
Anselm Lingnau's user avatar
12 votes
1 answer
1k views

How to pass a LaTeX argument verbatim to lua?

I would like to pass an argument verbatim from LaTeX to lua including LaTeX commands and end of line characters. The example below takes care of the former issue, but not of the latter. Is there a ...
JPi's user avatar
  • 13.7k
3 votes
3 answers
2k views

What's the alternative for the standard verbatim environment that can be used inside argument/does not change catcode?

How can I get something to typeset the output identical to that of a verbatim environment, e.g. of this code \documentclass[12pt]{article} \begin{document} before \begin{verbatim} 123456_789$^% \end{...
user202729's user avatar
  • 7,573
3 votes
2 answers
379 views

How can I print "$ formulae $" as itself?

If I type $ formulae $, then the result will be formulae But I want to type "$ formulae $" expression itself, so the result will be $ formulae $ (I mean the result include $ expressions!) Thanks ...
walkingandwalking's user avatar
5 votes
1 answer
294 views

How to print a verbatim block at its end automatically in LuaLaTeX?

This is a follow-up question to this answer by Mico. I try to adjust his Lua code to my needs and line numbering already works. Actually there is one real usability issue and that's my question: How ...
TeXnician's user avatar
  • 33.7k
2 votes
1 answer
615 views

verbatim code inside \newcommand definition

All the questions I could find on this subject are about people who want to use \verb in the argument passed to a command, or about people who want within a \newcommand to wrap one of the arguments ...
Stefan's user avatar
  • 123
3 votes
1 answer
175 views

Print LaTeX3 string verbatim

I can’t find a way to print the content of a LaTeX3 string and/or a text verbatim (or to be more precise, I found a solution by writing the content to a file and then displaying the verbatim content ...
tobiasBora's user avatar
  • 8,964
1 vote
2 answers
181 views

lstinline in mathmode with correct font size

I often typeset mathematical formulas about computer programs (loop invariants, etc.). I typeset them in typewriter font, saying in my preamble \lstset{basicstyle=\ttfamily}. I could say $\frac{\text{\...
ysalmon's user avatar
  • 1,160
3 votes
1 answer
156 views

shdoc and KOMA-Script

Why does the following example work with report, but not with scrreprt: \documentclass{scrreprt} \usepackage{shdoc} \begin{document} \begin{sh} \begin{shbox} \shline{}{Test} ...
TeXnician's user avatar
  • 33.7k
0 votes
2 answers
237 views

How to align multiple aligned env. containing \verb?

I need to align several R-syntax formulas as equations. I have a following code: \begin{align} &\begin{aligned} &\verb!tActKT ~ poly(I(1/nprocs), 3, raw=T) + poly(ndoms, 3, raw=T)!\\ &\...
Eenoku's user avatar
  • 533
1 vote
1 answer
272 views

About verbatim in LaTeX (and LuaTeX)

What I intend to do... Initially, I wanted to write a series of environments that help me typeset verbatim environments. For example, I would like \begin{myverb}{stylea} \end{myverb} to be equivalent ...
Alan Xiang's user avatar
  • 5,247
1 vote
1 answer
225 views

VerbatimInput gives error when file is too large [closed]

I use \VerbatimInput in package fancyvrb to wrap my text, which is loaded from external file. But when the external file is too large, it gives the following error: TeX capacity exceeded, sorry [...
firefighter's user avatar
1 vote
1 answer
107 views

Typesetting Preparsed Verbatim Text/Code

Assuming that I have already parsed some text verbatim, using an xparse +v argument, what is the best way to typeset the text in a way that respects the original formatting? Note that I cannot ...
Kelly Smith's user avatar
1 vote
1 answer
122 views

Macro with verbatim argument

Is it possible to define a macro \foo such that it can accept verbatim code like: \foo{cos(16 % 2)} without interpreting them as latex code first? I know I can use an environment for that, but I ...
tobiasBora's user avatar
  • 8,964
1 vote
1 answer
130 views

How to display variable content as verbatim? [duplicate]

I want to create a documentation .pdf that shows examples of code for my commands and also what the result is. To prevent differences between the description and the result I thought about creating a ...
mrCarnivore's user avatar
  • 1,515
0 votes
2 answers
61 views

Save the content of an environment containing \verb or \lstinline

I wish to copy the content of an environment into a macro (or into a temp file). Previously I use the following code: \usepackage{environ} \def\SavedContent{} \NewEnviron{savecontent}{% \BODY% ...
Jinwen's user avatar
  • 8,618
0 votes
1 answer
44 views

macros avoid linebreak if macro expands to nothing

I know this one is quite similar to this post (from me). But even with using % all over the place and \ignorespaces there is still a linebreak. See my mwe: (main2.tex) \documentclass{article} \...
atticus's user avatar
  • 587
1 vote
1 answer
38 views

Extra \fi error when listing inside a custom environment

I am trying to write a solutions environment sol which I can use to write solutions within assignments. There are two reasons for the environment, Solutions may be different colour. Solutions can be ...
scribe's user avatar
  • 335
0 votes
0 answers
39 views

\newcommand not working ("verbatim" use case) [duplicate]

I'm lazy and I want to save on typing. So I have \newcommand{\bv}{\begin{verbatim}} \newcommand{\ev}{\end{verbatim}} \bv Hi, this should be verbatim \ev in my document, but this produces an error: ...
user258532's user avatar
0 votes
0 answers
39 views

TikZ externalize if tikzpictures is wrapped [duplicate]

for simple use I've written an environment wrapping the tikzpicture environment. So far no trouble. Now I realized I've got a huge amount of tikzpictures in my document and I've read once about tikz ...
atticus's user avatar
  • 587