Verbatim in marginnote

309 views
Skip to first unread message

Kirk Lowery

unread,
Jun 16, 2008, 1:07:29 PM6/16/08
to tufte...@googlegroups.com
Hi!

I tried to do this:

\marginnote{\begin{Verbatim}
<bk>
<seg>
<T>
<N>
<W>
</N>
</T>
</seg>
</bk>
\end{Verbatim}}

And XeLaTeX complained:

./WHStechDescription.tex:49:Argument of \FV@BeginScanning has an extra
}. \end{Verbatim}}
./WHStechDescription.tex:49:Paragraph ended before \FV@BeginScanning
was complete. \end{Verbatim}}
./WHStechDescription.tex:49:Extra }, or forgotten \endgroup. \end{Verbatim}}
./WHStechDescription.tex:49:You can't use `\vadjust' in internal
vertical mode. \end{Verbatim}}
WHStechDescription.tex:0:Emergency stop.

Can one use this environment in a marginnote?

Kirk

Bil Kleb

unread,
Jun 16, 2008, 1:18:23 PM6/16/08
to tufte...@googlegroups.com
Kirk Lowery wrote:
> Hi!

Hi.

> Can one use this environment in a marginnote?

I can't even get Hello World,

\documentclass{tufte-handout}
\begin{document}
Hello world!
\end{document}

to typeset:

! Undefined control sequence.
\smallcapsspacing #1->\textls
[50]{#1}

presumably because I only have pdfTeX v1.21a?

\IfFileExists{microtype.sty}{%
\RequirePackage[final]{microtype}
% Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
\renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}

Kevin, is there a way to fail gracefully?

Later,
--
Bil Kleb

Kjell Magne Fauske

unread,
Jun 16, 2008, 2:15:07 PM6/16/08
to tufte...@googlegroups.com

Hi,

Verbatim text can usually not be part of a macro parameter. In order
to do that, you have to put the verbatim text in a box and use the box
as a parameter. The fancyvrb provides an environment for this. This
works for me:

%%%%%
\title{Verbatim margin notes}
\author{}
\date{}

\documentclass{tufte-handout}

\usepackage{fancyvrb}

\begin{document}
\maketitle

\begin{SaveVerbatim}{savedverb}


<bk>
<seg>
<T>
<N>
<W>
</N>
</T>
</seg>
</bk>

\end{SaveVerbatim}
\marginnote{\UseVerbatim{savedverb}}

\end{document}
%%%%

If you plan to do this often you should create a dedicated environment
for this. You can also use the marginfigure and margintable
environments since they use a similar trick:

\begin{marginfigure}
\begin{Verbatim}
...
\end{Verbatim}
\end{marginfigure}

Hope this helps!

Regards,
Kjell Magne Fauske

Kirk Lowery

unread,
Jun 16, 2008, 5:07:16 PM6/16/08
to tufte...@googlegroups.com
On Mon, Jun 16, 2008 at 1:18 PM, Bil Kleb <Bil....@nasa.gov> wrote:

You are using XeLaTeX? On what OS? What version of XeLaTeX?

> I can't even get Hello World,
>
> \documentclass{tufte-handout}
> \begin{document}
> Hello world!
> \end{document}

The following compiles without error on my G4 PowerBook (Leopard) with
TeXLive 2007 and on my Fedora 8 Linux box:

%%%begin test.tex%%%
\documentclass{tufte-handout}
%% These are necessary to handle UTF-8 files, which is what XeLaTeX expects
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
%%Choose Open Type fonts suitable to your system
\setromanfont[Mapping=tex-text]{TeX Gyre Schola}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{TeX Gyre Heros}
\setmonofont[Scale=MatchLowercase]{Bitstream Vera Sans Mono}

\title{Some title}
\author{Some author}
\begin{document}
\maketitle


Hello world!


\end{document}
%%%end test.tex%%%


> to typeset:
>
> ! Undefined control sequence.
> \smallcapsspacing #1->\textls
> [50]{#1}
>
> presumably because I only have pdfTeX v1.21a?

XeLaTeX is an alternative to pdfTeX

> \IfFileExists{microtype.sty}{%
> \RequirePackage[final]{microtype}
> % Set up letterspacing (using microtype package) -- requires pdfTeX v1.40+
> \renewcommand{\smallcapsspacing}[1]{\textls[50]{##1}}

microtype is incompatible with XeLaTeX. On my system, microtype
complains in the log, disables its features and disappears.

It took me a while to adjust to XeLaTeX and learn its basic features.
But even with that, I love it, for I work with multilingual documents
all the time...

HTH,

Kirk

Kirk Lowery

unread,
Jun 16, 2008, 5:15:51 PM6/16/08
to tufte...@googlegroups.com

It does, indeed! Works perfectly.

Thanks!

Kirk

Reply all
Reply to author
Forward
0 new messages