1

Using verbatim (not Verbatim) for transcribing handwritten documents.

I spend a lot of time transcribing wills, deeds, letters and other handwritten documents. In doing this I use the verbatim environment, mainly to allow me to place words exactly where they need to be as well as for fitting long lines within the framework of the page width.

I've worked out ways (using many helpful tips from this site, Thanks!) around verbatim's limitations to allow things like superscript, crossed through words and footnotes for references as I'll demonstrate in my minimal working examples (MWE) below but I have run up on a limitation of only being able to incorporate two catcodes at a time per verbatim environment group.

Is there anybody who could provide me with a method to incorporate more of these in a verbatim environment? A mwe of the method used would be -very- much appreciated.

For other reasons I can't use Verbatim in my efforts.

    \documentclass[12pt]{memoir}
    \usepackage{verbatim}
    \usepackage[normalem]{ulem} %used to enable the use of strike out text via \sout{striked out text}
    % Footnote treatment, This keeps footnotes flush and aligned to the left.
    \setlength{\footmarkwidth}{1.7em} % if your footnotes go into the hundreds, you need at least 1.7em 
    \setlength{\footmarksep}{0em} 
    \footmarkstyle{#1.\hfill} % this will give you plain numbers for your notes 
    \begin{document}
    \noindent First Example: 
    \noindent Escaped Footnote and Superscript within a verbatim environment:
    \begingroup{
    {\catcode`?=\active
    \def?!#1!{\footnote{#1}}
    {\catcode`+=\active
    \def+!#1!{\textsuperscript{#1}}
    \tiny\begin{verbatim}
    This is an example of a +!superscript! with subsequent escaped footnotes in a verbatim 
    environment?!See the First Example!
    \end{verbatim}
    \normalsize
    }}
    \normalsize
    \noindent
    Second Example: 
    \noindent
    Escaped Footnote and sout from the ulem package to line through a word within a 
    verbatim environment:
    \begingroup{
    {\catcode`?=\active
    \def?!#1!{\footnote{#1}}
    {\catcode`+=\active
    \def+!#1!{\sout{#1}} 
    \tiny\begin{verbatim}
    This is an example of a +!line of text! group of words being crossed out with 
    subsequent escaped footnotes in a verbatim environment?!See the Second Example!
    \end{verbatim}
    \normalsize
    }}
    \normalsize
    \end{document}

This yields the following (note: inserting the code block in this message body above required me to slightly modified some of the line placements but shouldn't matter much) enter image description here

I'd like to be able to create a verbatim environment where I can incorporate escaped footnotes, superscript, strike-through, tall curly braces and many other components found in old handwritten documents ALL into one environment. All help greatly appreciated. Thanks!

  • What's the problem in using fancyvrb and Verbatim? – egreg Apr 11 at 15:46
  • That looks rather hilarious. Wouldn't it be much easier to use \raggedright and to force newlines with \\ outside verbatim? – Ulrike Fischer Apr 11 at 15:46
3

Do you need verbatim at all?

\documentclass{article}
\usepackage{alltt}
\usepackage[normalem]{ulem}
\usepackage{xparse}

\ExplSyntaxOn

\NewDocumentEnvironment{hand}{}
 {
  \trivlist\ttfamily\footnotesize\raggedright\item
 }
 {
  \endtrivlist
 }

\NewDocumentCommand{\?}{m}
 {
  \str_case:nn { #1 }
   {
    {!}{ \gentexuser_footnote:w }
    {+}{ \gentexuser_sout:w }
    {@}{ \gentexuser_textsuperscript:w }
   }
 }

\cs_new_protected:Npn \gentexuser_footnote:w #1 ! { \footnote{#1} }
\cs_new_protected:Npn \gentexuser_sout:w #1 + { \sout{#1} }
\cs_new_protected:Npn \gentexuser_textsuperscript:w #1 @ { \textsuperscript{#1} }

\ExplSyntaxOff

\setlength{\textheight}{3cm} % just to make a smaller picture

\begin{document}

\begin{hand}
This is an example of a \?@superscript@ with subsequent escaped footnotes in a verbatim 
environment\?!See the First Example!

This is an example of a \?+line of text+ group of words being crossed out with 
subsequent escaped footnotes in a verbatim environment\?!See the Second Example!
\end{hand}

\end{document}

enter image description here

| improve this answer | |
  • Nice! What other operators are there besides !, + and @ for this? Are there any others? – gentexuser Apr 11 at 16:39
  • @gentexuser I defined each of them. You can add to the list, using the same scheme. – egreg Apr 11 at 16:51
  • Right, I realize that. I was asking what characters are useable to make new definitions. Some (like `$') I think wouldn't be able to be used. – gentexuser Apr 11 at 16:54
  • @gentexuser You can use whatever character you want. – egreg Apr 11 at 17:00
  • 1
    @gentexuser \hspace*{#1}, perhaps. – egreg Apr 11 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.