\documentclass{article}
\usepackage{amsmath,array,booktabs,multirow}
\begin{document}
\begin{table}[!htb]
\centering
%\begin{tabular}{ l l }
\begin{tabular}{ >{\verb=}l<{=} l }
% Chap2.nb & notebook \\
PI_all_data_BBB_M15X.pdf & Results for \verb=BBB= model with profile plots \\
PI_all_data_BetaBin_M15X.pdf & Results for \verb=BetaBin= model with profile plots \\
PI_all_data_BinLNB_M15X.pdf & Results for \verb=BinLNB= model with profile plots \\
PI_all_data_Bin_M15X.pdf & Results for \verb=Bin= model with profile plots \\
PI_all_data_LogGamma_M15X.pdf& Results for \verb=LogGamma= model with profile plots \\
PI_all_data_TwoBin_M15X.pdf & Results for \verb=TwoBin= model with profile plots \\
\end{tabular}
\end{table}
\end{document}
我希望第一列对每一行都一字不差。目前,结果非常奇怪,它似乎也进入了第二列。
我该如何改变它?
谢谢
答案1
使用collcell
收集单元格内容,然后进行解析\detokenize
d:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{array,collcell}
\newcommand{\myverb}[1]{\ttfamily\detokenize{#1}}
\begin{document}
\begin{tabular}{ >{\collectcell\myverb}l<{\endcollectcell} l }
PI_all_data_BBB_M15X.pdf & Results for \verb=BBB= model with profile plots \\
PI_all_data_BetaBin_M15X.pdf & Results for \verb=BetaBin= model with profile plots \\
PI_all_data_BinLNB_M15X.pdf & Results for \verb=BinLNB= model with profile plots \\
PI_all_data_Bin_M15X.pdf & Results for \verb=Bin= model with profile plots \\
PI_all_data_LogGamma_M15X.pdf& Results for \verb=LogGamma= model with profile plots \\
PI_all_data_TwoBin_M15X.pdf & Results for \verb=TwoBin= model with profile plots
\end{tabular}
\end{document}
作为参考,请参阅单词(文本)中的下划线和如何将宏应用于表格的每一列。
答案2
对于打印文件名,您不需要\verb
,只需下划线即可打印。
\documentclass{article}
\usepackage{amsmath,array,booktabs}
\begin{document}
\begin{tabular}{ >{\ttfamily\catcode`_=12 }l l }
% Chap2.nb & notebook \\
PI_all_data_BBB_M15X.pdf & Results for \texttt{BBB} model with profile plots \\
PI_all_data_BetaBin_M15X.pdf & Results for \texttt{BetaBin} model with profile plots \\
PI_all_data_BinLNB_M15X.pdf & Results for \texttt{BinLNB} model with profile plots \\
PI_all_data_Bin_M15X.pdf & Results for \texttt{Bin} model with profile plots \\
PI_all_data_LogGamma_M15X.pdf & Results for \texttt{LogGamma} model with profile plots \\
PI_all_data_TwoBin_M15X.pdf & Results for \texttt{TwoBin} model with profile plots \\
\end{tabular}
\end{document}