1

I have a long table which should have a verbatim enviroment on the left side. MWE:

\documentclass{article}
\usepackage{float}
\usepackage{tabularx}
\usepackage{array}
\usepackage{graphicx} 
\usepackage{booktabs}
\usepackage{fvextra}
\begin{document}

\begin{table}[H]
    \centering
    \resizebox{\textwidth}{!}{%
        \begin{tabular}{@{}ll@{}}
            \toprule
            Command                                             & Meaning                                       \\ \midrule
            \Verb|AND{S} <Rd>, <Rn>, <Rm>{, <shift> #<amount>}| & Performs a binary AND on \Verb|<Rn>| and \Verb|<Rm>| \\
   \bottomrule
        \end{tabular}
    }
\end{table}
\end{document}

Somewhere I picked up that I can't use the \verb enviroment in a table, but the \Verb enviroment should be fine. But, somehow, the \Verb enviroment produces double hashtags:

enter image description here

How can I avoid this? Is there a possibility to get the \verb font without actually using it?

4
  • 3
    you could use \verb in a tabular, but not in \resizebox but you should never \resizebox tables, it forces inconsistent font sizes Sep 12 at 6:35
  • @DavidCarlisle Would adjustbox be a feasible solution instead of \resizebox?
    – Ceriana
    Sep 12 at 6:45
  • 4
    @Ceriana nothing that simply scales your contents is a feasible solution. Fix your table, for instance by using a p-type column for the "Meaning" instead of two l-columns.
    – Skillmon
    Sep 12 at 6:53
  • no it is not the \resizebox command, it is the idea of scaling tables that should be avoided. Choose a suitable font size such as \small don't just scale Sep 12 at 15:30

1 Answer 1

2

I'd go with breaking lines in cells.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{tabularx}
\usepackage{booktabs}

\NewDocumentCommand{\pv}{v}{\texttt{#1}}

\begin{document}

\begin{center}
\catcode`#=12 % we need to print #

\begin{tabular}{
  @{}
  >{\raggedright\hangindent=1em\hangafter=1 }p{\dimeval{0.6\textwidth-\tabcolsep}}
  >{\raggedright\arraybackslash\hangindent=1em\hangafter=1 }p{\dimeval{0.4\textwidth-\tabcolsep}}
  @{}
}
\toprule
\normalfont  Command & Meaning \\
\midrule
\pv|AND{S} <Rd>, <Rn>, <Rm>{, <shift> #<amount>}| &
Performs a binary AND on \pv|<Rn>| and \pv|<Rm>| \\
\bottomrule
\end{tabular}

\end{center}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .