2

I'm trying to get a specific output and for now it's not as I wish.

Desired output:

This is the result i'm looking for

It's for a TugBoat article. For now I have this solution :

    \documentclass{ltugboat} 
        \usepackage{fancyvrb}

        \begin{document}
        Some text
        \begin{Verbatim}[frame=single]
            \actsymb[<ll>][<ul>]{<symbol>}{<lr>}[<ur>]
        \end{Verbatim}
        \end{document}

Actual output:

actual output

5

fancyvrb allows you to escape to regular LaTeX macros inside the verbatim content. This is described nicely in the manual.

enter image description here

\documentclass{ltugboat} 
\usepackage{fancyvrb}

\newcommand\param[1]{\textrm{$\langle$\textit{#1}$\rangle$}}

\begin{document}
Some text
\begin{Verbatim}[frame=single,commandchars=+\(\)]
  \actsymb[+param(ll)][+param(ul)]{+param(symbol)}{+param(lr)}[+param(ur)]
\end{Verbatim}
\end{document}

enter image description here

  • Tks, it's perfect! – David Beauchemin Jul 19 '17 at 0:00
  • The ltugboat class provides \meta for your hand made \param. – egreg Jul 19 '17 at 12:09
1

Using verbatimbox with a little \catcode magic sprinkled on top. In doing it this way, the verbatim input needs no escape characters, but is instead put in directly as (in this case) \actsymb[<ll>][<ul>]{<symbol>}{<lr>}[<ur>].

\documentclass{article}
\usepackage{verbatimbox}
\catcode`>=\active %
\catcode`<=\active %
\def\openesc{\itshape\rmfamily$\langle$}
\def\closeesc{\/$\rangle$\upshape\ttfamily}
\def\vbdelim{%
  \catcode`<=\active %
  \catcode`>=\active %
  \def<{\openesc}%
  \def>{\closeesc}%
}
\catcode`>=12 %
\catcode`<=12 %
\begin{document}
\begin{verbbox}[\vbdelim]
\actsymb[<ll>][<ul>]{<symbol>}{<lr>}[<ur>]
\end{verbbox}
\fbox{\theverbbox}
\end{document}

enter image description here

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.