@@ -24,11 +24,11 @@ which simply regurgitates its argument, and use it as:
24
24
``` latex
25
25
\unbrace{\verb+\error+}
26
26
```
27
- the combinartion will not (it will attempt to execute ` \error ` ).
27
+ the combination will not (it will attempt to execute ` \error ` ).
28
28
Other errors one
29
29
may encounter are "` \verb ` ended by end of line", or even the
30
30
rather more helpful "` \verb ` illegal in command argument". The
31
- same sorts of thing happen with ` \begin{verbatim} ` &hellip ;
31
+ same sort of thing happen with ` \begin{verbatim} ` &hellip ;
32
32
` \end{verbatim} ` :
33
33
<!-- {% raw %} -->
34
34
``` latex
@@ -50,15 +50,13 @@ matching `\end{verbatim}`.
50
50
This is why the LaTeX book insists that verbatim
51
51
commands must not appear in the argument of any other command; they
52
52
aren't just fragile, they're quite unusable in any "normal" command
53
- parameter,
54
- regardless of [ ` \protect ` ion] ( FAQ-protect ) . (The ` \verb `
53
+ parameter, regardless of [ ` \protect ` ion] ( FAQ-protect ) . (The ` \verb `
55
54
command tries hard to detect if you're misusing it; unfortunately, it
56
55
can't always do so, and the error message is therefore not reliable as an
57
56
indication of problems.)
58
57
59
- The first question to ask yourself is: "is ` \verb ` actually
60
- necessary?".
61
-
58
+ The first question to ask yourself is: "is ` \verb ` actually necessary?".
59
+
62
60
63
61
- If ` \texttt{_your text_} ` produces the same result
64
62
as ` \verb+_your text_+ ` , then there's no need of
@@ -99,14 +97,15 @@ Another way out is to use one of "argument types" of the
99
97
\cmd{Command }|\furble|{ isn't defined}
100
98
```
101
99
Which gives us:
102
- Command ` \furble ` isn't defined
100
+ ``` raw
101
+ Command `\furble` isn't defined
102
+ ```
103
103
The ` m ` tag argument specifies a normal mandatory argument,
104
104
and the ` v ` specifies one of these verbatim arguments.
105
105
As you see, it's implanting a ` \verb ` -style command argument in the
106
- argument sequence of an otherwise "normal" sort of command; that
107
- ` | `
108
- may be any old character that doesn't
109
- conflict with the content of the argument.
106
+ argument sequence of an otherwise "normal" sort of command; that ` | `
107
+ may be any old character that doesn't conflict with the content of
108
+ the argument.
110
109
111
110
This is pretty neat (even if the verbatim is in an argument of its
112
111
own) but the downside is that [ ` xparse ` ] ( https://ctan.org/pkg/xparse ) pulls in
@@ -115,7 +114,7 @@ the experimental LaTeX3 programming environment
115
114
116
115
Other than the [ ` cprotect ` ] ( https://ctan.org/pkg/cprotect ) package, there are four partial
117
116
solutions to the problem:
118
-
117
+
119
118
120
119
- Some packages have macros which are designed to be responsive
121
120
to verbatim text in their arguments. For example,
@@ -127,15 +126,15 @@ solutions to the problem:
127
126
arguments of other commands, but it can clash with other packages:
128
127
for example, ` \VerbatimFootnotes ` interacts poorly with the
129
128
` para ` option of the [ ` footmisc ` ] ( https://ctan.org/pkg/footmisc ) package.
130
-
129
+
131
130
132
131
The [ ` memoir ` ] ( https://ctan.org/pkg/memoir ) class defines its ` \footnote ` command so that
133
132
it will accept verbatim in its arguments, without any supporting package.
134
133
- The [ ` fancyvrb ` ] ( https://ctan.org/pkg/fancyvrb ) package defines a command ` \SaveVerb ` ,
135
134
with a corresponding ` \UseVerb ` command, that allow you to save
136
135
and then to reuse the content of its argument; for details of this
137
136
extremely powerful facility, see the package documentation.
138
-
137
+
139
138
140
139
Rather simpler is the [ ` verbdef ` ] ( https://ctan.org/pkg/verbdef ) package, whose ` \verbdef `
141
140
command defines a (robust) command which expands to the verbatim
@@ -156,13 +155,11 @@ solutions to the problem:
156
155
- The [`tcolorbox`](https://ctan.org/pkg/tcolorbox) package provides a similar facility
157
156
- If you have a single character that is giving trouble (in
158
157
its absence you could simply use `\texttt`), consider using
159
- `\string`. `\texttt{my`\string`_name}`
160
- typesets the same as
158
+ `\string`. `\texttt{my`\string`_name}` typesets the same as
161
159
`\verb+my_name+`, and will work in the argument of a command. It
162
160
won't, however, work in a moving argument, and no amount of
163
- [`\protect`ion](FAQ-protect) will make it work in
164
- such a case.
165
-
161
+ [`\protect`ion](FAQ-protect) will make it work in such a case.
162
+
166
163
167
164
A robust alternative is:
168
165
```latex
@@ -175,7 +172,7 @@ solutions to the problem:
175
172
troublesome character (though it's plainly not necessary for things
176
173
like percent signs for which (La)TeX already provides
177
174
robust macros).
178
-
175
+
179
176
180
177
- One may also consider putting verbatim material in an external
181
178
file; this is somewhat more tedious, but the file may be reused
@@ -188,7 +185,7 @@ solutions to the problem:
188
185
```
189
186
which (as one might guess) writes to the named file; load the saved
190
187
contents using `\input{<file name>}`
191
-
188
+
192
189
193
190
A second environment puts your verbatim material in an (apparently)
194
191
anonymous temporary file:
@@ -200,14 +197,14 @@ solutions to the problem:
200
197
In this case, you use the anonymous file with the `\tcbusetemp`
201
198
macro. (You can change the name used for the "anonymous" file, if
202
199
its default proves troublesome.)
203
-
200
+
204
201
205
202
The [`moreverb`](https://ctan.org/pkg/moreverb) package provides a `\verbatimwrite`
206
203
command, which doesn't provide an anonynous file.
207
-
204
+
208
205
209
206
Macros, to achieve the same effect, are outlined in the
210
- documentation of the [`verbatim`](https://ctan.org/pkg/verbatim) package; the macros use the
211
- facilities of the package, but the user has to write a mini-package
212
- actually to use them.
207
+ documentation of the [`verbatim`](https://ctan.org/pkg/verbatim) package;
208
+ the macros use the facilities of the package, but the user has to write
209
+ a mini-package actually to use them.
213
210
0 commit comments