Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • tabout version 3 topf and botf options not working as expected

    The topf and botf options to -tabout- don't appear to be replacing the top and bottom of the latex document.

    Here is an example:

    top.tex contents:

    Code:
    \documentclass{report}
    
    \usepackage{booktabs}
    
    \usepackage{tabularx}
    
    
    
    
    \begin{document}
    
    \begin{center}
    
    \footnotesize
    
    \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
    
    \begin{tabularx} {#} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
    
    \toprule
    bot.tex contents:

    Code:
    \bottomrule
    
    \addlinespace[.75ex]
    
    \end{tabularx}
    
    \par
    
    \scriptsize{\emph{Source: }#}
    
    \normalsize
    
    \end{center}
    
    \end{document}
    tabout command:

    Code:
    sysuse nlsw88, clear
    
    tabout race union using table1.tex, ///
    cells(freq col) format(1) clab(Freq Col_%) ///
    replace ///
    style(tex) bt font(bold) cl1(2-7) cl2(2-3 4-5 6-7) ///
    topf(top.tex) botf(bot.tex) topstr(14cm) botstr(nlsw88.dta)
    If I run the tabout command in the same directory as top.tex and bot.tex the output is:

    Code:
    \documentclass{report}
    
    \usepackage{booktabs}
    
    \usepackage{tabularx}
    
    
    
    
    \begin{document}
    
    \begin{center}
    
    \footnotesize
    
    \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
    
    \begin{tabularx} {14cm} {@{} l Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y@{}} \\
    
    \toprule
    
    \begin{center}
    
    \footnotesize
    
    \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
    
    \begin{tabularx} {14} {@{} l Y Y Y @{}}
    
    \toprule
    
    & \multicolumn{3}{c}{\textbf{union worker}}  \\
    
    \cmidrule(l{1em}){2-4} 
    
     & \textbf{nonunion} & \textbf{union} & \textbf{Total} \\
    
    \cmidrule(l{1em}){2-4} 
    
     & Freq & Freq & Freq \\
    
    \midrule 
    
    \textbf{race} \\
    
    white & 1051.0 & 302.0 & 1353.0 \\
    
    black & 350.0 & 151.0 & 501.0 \\
    
    other & 16.0 & 8.0 & 24.0 \\
    
    Total & 1417.0 & 461.0 & 1878.0 \\
    
    \bottomrule
    
    \end{tabularx}
    
    \normalsize
    
    \end{center}
    
    \bottomrule
    
    \addlinespace[.75ex]
    
    \end{tabularx}
    
    \par
    
    \scriptsize{\emph{Source: }nlsw88.dta}
    
    \normalsize
    
    \end{center}
    
    \end{document}
    The above latex document produces an error when typesetting.

    I expected the contents of top.tex to replace this section of the output:

    Code:
    \begin{center}
    
    \footnotesize
    
    \newcolumntype{Y}{>{\raggedleft\arraybackslash}X}
    
    \begin{tabularx} {14} {@{} l Y Y Y @{}}
    
    \toprule
    Instead, top.tex is just placed on top of the above code. Is this the intended output?

  • #2
    Note that I am using Stata 15.1 and tabout version 3.0.9 beta on a Mac running macOS Version 10.15.6. Perhaps someone could try to replicate the output above.

    Comment


    • #3
      The -ntc- option needs to be added to the tabout command above.
      This is actually documented in page 88 of the version 3 user guide:
      As mentioned earlier, making LATEX easier to use hasn’t come at the expense of experienced users losing out. If you specify ntc (no table code), tabout will suppress this automatic table code and you can still create your own custom code for inclusion via the topf and botf options.

      Comment

      Working...
      X