1

I am surprised that I get an error when I add Verbatim to content of minipage that had \fbox around it. Removing the \fbox removes the error. But I need to put frame around the minipage. I can't use framed package, since tex4ht does not work with it (known bug) that is present in texlive 2014.

MWE

\documentclass[]{article}
\usepackage{fancybox,fancyvrb}    
\begin{document}
\fbox{
\begin{minipage}[t]{\textwidth}
\begin{enumerate}
\item one    
  \begin{Verbatim}
    this is verbatim
  \end{Verbatim}    
\item two
\end{enumerate}
\end{minipage}
}
\end{document}

error

>lualatex foo.tex
This is LuaTeX, Version beta-0.79.1 (TeX Live 2014) (rev 4971) 
 restricted \write18 enabled.
(./foo.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2014/texmf-dist/tex/latex/fancybox/fancybox.sty
Style option: `fancybox' v1.4 <2010/05/15> (tvz)
) (/usr/local/texlive/2014/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)
(/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty)) (./foo.aux)
Runaway argument?
this is verbatim \end {Verbatim} 
! Paragraph ended before \FV@BeginScanning was complete.
<to be read again> 
\par 
l.18 }

? 

When removing the \fbox, it works:

\documentclass[]{article}
\usepackage{fancybox,fancyvrb}
\begin{document}
\begin{minipage}[t]{\textwidth}
\begin{enumerate}
\item one
\begin{Verbatim}
 this is verbatim
\end{Verbatim}
\item two
\end{enumerate}
\end{minipage}
\end{document}

Using framed works in pdf, but not in tex4ht, so I can't use it.

\documentclass[]{article}
\usepackage{fancybox,fancyvrb}
\usepackage{framed}  %can't use this in tex4ht
\begin{document}
\begin{framed}
\begin{minipage}[t]{\textwidth}
\begin{enumerate}
\item one
\begin{Verbatim}
 this is verbatim
\end{Verbatim}
\item two
\end{enumerate}
\end{minipage}
\end{framed}
\end{document}

htlatex foo.tex
(/usr/local/texlive/2014/texmf-dist/tex/generic/tex4ht/html4.4ht)
(/usr/local/texlive/2014/texmf-dist/tex/generic/tex4ht/html4-math.4ht))
(./foo.aux)
! You can't use `\prevdepth' in horizontal mode.
\nointerlineskip ->\prevdepth 
                              -\@m \p@ 
l.19 \end{framed}

? 

So I am stuck now. I need a way to put frame around some text, that contains Verbatim, that is all, but have it work with both pdf and tex4ht. That is why I am using \fbox and minipage

Is there a way to make \fbox work with the minipage having Verbatim in it? Why adding fbox gives an error with Verbatim in minipage? So many strange interactions between Latex packages.

texlive 2014 and Miktex 9

2
  • 1
    this is not a strange interaction between packages it is standard documented behaviour that you can not use verb/verbatim in the argument of a command. you need to use fancyverb or one of the framed packages, and then if necessary teach tex4ht about that. Mar 10, 2015 at 18:09
  • @DavidCarlisle thanks for the link. The answer by Bruno Le Floch there had the solution. It was to use \cprotect\fbox and now it works. So I will close this as duplicate then. Thanks again.
    – Nasser
    Mar 10, 2015 at 18:29

0

Browse other questions tagged .