0

I want to draw a table with two columns: the first one contains some LaTeX commands and the second one its preview. Instead of inserting the command \verb++ in each row, I want to benefit from <> column-specifiers. But this results on compilation errors. Please consider the following MWE:

\documentclass{article}
\usepackage{booktabs}

\begin{document} \begin{table} \centering \begin{tabular}{ll} %\begin{tabular}{>{\verb+}l<{+}l} <--- what I want to use \verb+\LaTeX+ & \LaTeX \end{tabular} \end{table} \end{document}

R. ALOUI
  • 47
  • 5

1 Answers1

1

https://tex.stackexchange.com/a/207977/197451

First method with collectcell and detokenise

enter image description here

\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}

Second method with shortvrb package

enter image description here

\documentclass{article}
\usepackage{shortvrb}

\MakeShortVerb{|}

\begin{document}

\begin{tabular}{l l} |some % text here| & some text here \ |some $ text here| & some text here \ |some { text here| & some text here \ \end{tabular}

\end{document}

https://tex.stackexchange.com/a/297214/197451

js bibra
  • 21,280