I have to write a table with two columns and in each column I have to place small C code snippets. Using the \code{}
in each column seems to be very tedious because I have to write
\code{}
in each line on each box of the table.
\begin{table}[htp]
\caption{Possible transformations}
\begin{minipage}{\columnwidth}
\centering
{\small
\begin{tabular}{|l|l|}\hline\hline
code1 & code2 \\\hline
\code{float PI = 3.14;} & \code{constexpr double PI = 3.14;} \\\hline
\code{if(A > B) A = B } & \code{void F(T\& A, const T\& B)}\\
& \code{\{if (A>B) A=B; \} } \\\hline
\end{minipage}
\label{tab:general-transformation}
\end{table}
Also I want 2-3 lines of code in each box. How do I do that? Thanks.
\code
come from, for example?) and adocument
environment. In other words, we should be able to copy the whole thing into a new file and compile it. At the same time, it should be minimal, so any packages etc. that doesn't influence the problem, should be left out.