Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How <code>\begin{verbatim}</code> works. briefly and roughly.</p> <ol> <li><code>\begin{verbatim}</code> is expanded to <code>\verbatim</code>. </li> <li>Then <code>\verbatim</code> sets category code of each special characters to 12. Now all chars is like digits or puncts.</li> <li>Then <code>\verbatim</code> sets font, parindent and calls <code>\@xverbatim</code>.</li> <li><p><code>\@xverbatim</code> catches the end of verbatim using the following trick:</p> <pre><code>\def\@xverbatim#1\end{#1\end} </code></pre></li> <li><p>Then <code>\end{verbatim}</code> finishes work.</p></li> </ol> <p>How <code>\newcommand{\codeblock}[1]{\begin{quote}\begin{verbatim}#1\end{verbatim}\end{quote}}</code> works.</p> <ol> <li>First of all <code>\codeblock{Some {}$&amp;%^_}</code> reads its argument.</li> <li><p><code>#1 --&gt; Some code {}$&amp;%^_</code></p> <p><strong>Note:</strong> <code>{</code>,<code>}</code>,<code>$</code>,<code>&amp;</code>,<code>%</code>,<code>^</code>,<code>_</code> have categories 1,2,3,4,6,7,8 <strong>rather than 11 or 12!!!</strong>)</p></li> <li><code>\codeblock</code> expands to <code>\begin{quote}\begin{verbatim} Some {}$&amp;%^_\end {verbatim}\end {quote}</code>. <strong>Important:</strong> backslash of <code>\end</code> has category 0 rather than 11. Moreover <code>{</code> and <code>}</code> have categories 1 and 2 rather than 11. And <code>$</code>,<code>&amp;</code>,<code>%</code>,<code>^</code>,<code>_</code> have categories 3,4,6,7,8.</li> <li><code>\begin{quote}</code> expands to <code>\quote</code> and <code>\quote</code> executes.</li> <li>Then <code>\begin{verbatim}</code> expands to <code>\varbatim</code>. <code>\varbatim</code> changes all categories and font. But (<strong>important</strong>) the category of backslash (in <code>\end</code>) remains equal to 0. And the categories of <code>{</code>, <code>}</code>, <code>$</code>, <code>&amp;</code>, <code>%</code>, <code>^</code>, <code>_</code> typed after <code>Some</code> remains because of "argument reading" executes before <code>\verbatim</code> changes all categories. But you need that all char has categories 11 o 12.</li> <li>Then <code>\verbatim</code> calls <code>\@xverbatim</code>.</li> <li><p><code>\@xverbatim</code> tries to catch your argument using the following trick:</p> <pre><code>\def\@xverbatim#1\end{#1\end} </code></pre> <p>but it is impossible because of <code>\@xverbatim</code> tries to catch <code>\end</code> where all letters (<code>\</code>,<code>e</code>,<code>n</code>,<code>d</code>) have the category 12 and 11. But in fact there are four letters with other category code: <code>\</code> with category 0 and <code>e</code>,<code>n</code>,<code>d</code> with category 11. </p> <p>It is possible (I am not sure) that trick is more masterly:</p> <p><img src="https://i.stack.imgur.com/w8ZBf.png" alt="alt text"></p> <p>Red chars have category 12. Green chars have category 11. <code>\def</code>, <code>\@xverbatim</code>, <code>\end</code> are macros with <code>\</code> (category 0) and letters (category 11).</p></li> <li><p><code>\@xverbatim</code> is trying and trying to find <code>\end</code> where backslash (<code>\</code>) has category 11 but.... <code>File ended while scanning use of \@xverbatim</code></p></li> </ol> <p>If you want to create new macro <code>\codeblock</code> you must do something like above text.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload