Short captions for LaTeX tables with stargazer

3.9k views Asked by At

In LaTeX, a short captions (that will appear in the List of Figures) can be made with the following code:

  \caption[Short caption.]{Long caption.}

With stargazer in R I tried this:

stargazer(mtcars, summary = FALSE, title="[Short caption]Long caption")

Which produces this output for the captions:

  \caption{[Short caption]Long caption} 

How can I make a short caption with stargazer?

1

There are 1 answers

0
AndB On

Using stargazer you can to disable it's float option. Nesting the stargazer chunk in a manually provided table environment then lets you customize any captions or labels manually, i.e.

\begin{table}
\caption[Short caption]{The main caption of the table.}
\label{tab:mtcars}
\centering

<<results="asis",echo=F>>=
stargazer(mtcars[1:5, 1:3], summary = FALSE,float=F)
@

\end{table}