I have created a table that fits my exact specifications using frmttable. I'm trying to output this table so that I can import it in LaTeX. I'd like to be able to adjust the column widths, so that I can wrap the first column. This is easy to do within LaTeX if the outputted .tex file doesn't contain the \begin{tabular}{lcc} and \end{tabular} lines. Other stata table commands (e.g. esttab) don't create these lines in latex output. But esttab doesn't have the flexibility of frmttable/outreg. My question is:
- How can I output a mata structure created with frmttable to a latex file fragment that does not contain the "\begin{tabular}" and "\end{tabular}" code?
- How can I substitute text with latex code in a table created from a mata structure? [for example, replace "degrees" with "$^{\circ}\$"]
Here is some basic code that replicates the challenge:
mat stuff = 3, 5, 8, 2
frmttable, append(mytable) statmat(stuff) substat(1) sdec(2) nocoltitl rtitles("A long row title describing this confusing variable (degrees celcius)")
outreg using "MyTable.tex", replay(mytable) ctitles("","Col 1", "Col 2") tex fragment replace
Here are the contents of the MyTable.tex file:
\begin{center}
\begin{tabular}{lcc}
\hline \noalign{\smallskip} & Col 1 & Col 2\\
\noalign{\smallskip}\hline \noalign{\smallskip}A long row title describing this variable (degrees celcius) & 3.00 & 8.00\\
& \begin{footnotesize}(5.00)\end{footnotesize} & \begin{footnotesize}(2.00)\end{footnotesize}\\
\noalign{\smallskip}\hline\end{tabular}\\
\end{center}
- How can I output a mata structure created with frmttable to a latex file fragment that does not contain the "\begin{tabular}" and "\end{tabular}" code?
- How can I substitute text with latex code in a table created from a mata structure? [for example, replace "degrees" with "$^{\circ}\$"]
Here is some basic code that replicates the challenge:
mat stuff = 3, 5, 8, 2
frmttable, append(mytable) statmat(stuff) substat(1) sdec(2) nocoltitl rtitles("A long row title describing this confusing variable (degrees celcius)")
outreg using "MyTable.tex", replay(mytable) ctitles("","Col 1", "Col 2") tex fragment replace
Here are the contents of the MyTable.tex file:
\begin{center}
\begin{tabular}{lcc}
\hline \noalign{\smallskip} & Col 1 & Col 2\\
\noalign{\smallskip}\hline \noalign{\smallskip}A long row title describing this variable (degrees celcius) & 3.00 & 8.00\\
& \begin{footnotesize}(5.00)\end{footnotesize} & \begin{footnotesize}(2.00)\end{footnotesize}\\
\noalign{\smallskip}\hline\end{tabular}\\
\end{center}
Comment