Victor Kostyuk
Victor Kostyuk

Reputation: 661

Table numbering in texreg output

Texreg is the only package I found that produces nicely formatted Latex tables for multi-level regression (e.g., lmer).

The generated table caption is "Table N: caption", where N is the number of texreg tables in the document up to that point, including the current table. The caption text can be set using the caption parameter, but I can't find a way to change the "Table N:"

This is an issue if other types of tables (e.g., xtable) are also used in the same RMarkdown/knitr document.

Is there a way to modify this part of the caption without manually changing the compiled .tex file?

Upvotes: 1

Views: 284

Answers (1)

Philip Leifeld
Philip Leifeld

Reputation: 2323

texreg creates a tabular environment that contains the actual table. By default, texreg additionally wraps this tabular environment in a table float, which positions the table on the page and creates the caption. If you choose to do this manually, you can use texreg's argument table = FALSE. In that case, you may want to write the code for the table float manually in your LaTeX file and possibly adjust the caption in custom ways:

\begin{table}
  <insert texreg output with table = FALSE here>
  \caption{My table}
\end{table}

You can edit the caption manually or redefine the caption command to do whatever you want. This source contains some useful suggestions on how to redefine the appearance of the caption.

Upvotes: 2

Related Questions