我有一张长桌子,其左侧应该有一个逐字环境。 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}
我在某个地方发现我不能在表格中使用 \verb 环境,但 \Verb 环境应该没问题。但不知何故,\Verb 环境产生了双重标签:
我该如何避免这种情况?是否有可能在不实际使用 \verb 字体的情况下获取它?
答案1
我会在单元格中换行。
\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}