[texhax] verbatim environment problem

E. Krishnan ekmath at asianetindia.com
Tue Feb 20 02:15:55 CET 2007


On Mon, 19 Feb 2007, Don Gingrich wrote:

> I'm writing an explanatory text about Bourne shell scripting.
> 
> The following file demonstrates the problem:
> 
> 
> \documentclass[12pt,a4paper]{article}
> \setlength{\oddsidemargin}{-0.25in}
> \setlength{\textwidth}{7in}
> \setlength{\topmargin}{-1in}
> \setlength{\textheight}{9.55in}
> \usepackage{amsfonts}
> \usepackage{graphicx}
> \usepackage{fancybox}
> \usepackage{a4wide,epsfig,ifthen,alltt}
> \usepackage{ulem}
> \usepackage{float,graphics,verbatim,moreverb}
> \usepackage{upquote}
> \usepackage{textcomp}
> \usepackage{listings}
> \floatstyle{boxed}
> \restylefloat{table}
> 
> \begin{document}
> 
> \fbox{\parbox{14cm}{
> 
> \textbf{Note:} One of the problems with \textsc{Unix} as an ``open
> system'' is that a variety of people have developed \textsc{Unix}
> commands, shells and other tools. There is no corporate ``big brother''
> making sure that all of the commands work the same way. The above
> construct is a case in point. In Bourne shell and Korn shell the correct
> usage is as above:\\ \begin{alltt}
> 	ls .[!.]*
> \end{alltt}
> 
> But, for \texttt{tcsh} (the default login shell on CS\&IT systems),
> \texttt{csh}, \texttt{zsh}, BASH and probably a few other shells that
> use command history systems, the ``!'' character is used to signify a
> substitution from the command history.
> 
> On these shells, to get the same result you would need to use:\\
> \begin{alltt}
> 	ls .[^.]*
> \end{alltt}
> }}
> 
> \end{document}
> 
> -------------------------------------------------------------------------------------
> The error message from LaTeX is:
> 
> Underfull \hbox (badness 10000) in paragraph at lines 42--42
> 
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.42 }}
>        
> ? q
> OK, entering \batchmodeExit 1


Please try usng the packages "boxedminipage" and "fanvyvrb", as below:

  \begin{boxedminipage}{14cm}
    \textbf{Note:} One of the problems with \textsc{Unix} as an ``open
    system'' is that a variety of people have developed \textsc{Unix}
    commands, shells and other tools.  There is no corporate ``big
    brother'' making sure that all of the commands work the same way.
    The above construct is a case in point.
    In Bourne shell and Korn shell the correct usage is as above:
    \begin{Verbatim}
      ls .[!.]*
    \end{Verbatim}
    
    But, for \texttt{tcsh} (the default login shell on CS\&IT systems),
    \texttt{csh}, \texttt{zsh}, BASH and probably a few other shells
    that use command history systems, the ``!'' character is used to
    signify a substitution from the command history.
  
    On these shells, to get the same result you would need to use:
    \begin{Verbatim}
      ls .[^.]*
    \end{Verbatim}
    \end{boxedminipage}

I think plain "verbatim" package works here, but you may need "fancyvrb"
to do some fncy things later.

-- 
Krishnan



More information about the texhax mailing list