简体   繁体   中英

Stargazer notes line wrap?

Is there a way to get notes in stargazer to wrap lines instead of running off the page?

stargazer(fit.1, notes="A very very long note that I would like to put below the table, but currently runs off the side of the page when I compile my document. How do I get this to wrap into paragraph form?")

Which produces:

\hline \\[-1.8ex] 
\textit{Notes:} & \multicolumn{2}{l}{$^{*}$P $<$ .05} \\ 
 & \multicolumn{2}{l}{$^{**}$P $<$ .01} \\ 
 & \multicolumn{2}{l}{$^{***}$P $<$ .001} \\ 
 & \multicolumn{2}{l}{A very very long note that I would like to put below the table, but currently runs off the side of the page when I compile my document. How do I get this to wrap into paragraph form?} \\ 
\normalsize 
\end{tabular} 
\end{table} 

I couldn't find anything in the manual for adjusting this.

The notes argument accepts a vector of character strings, and will put each on a new line. In your example, the following should work:

stargazer(linear.1, notes=c("A very very long note that I would like to put below the table,",
                     "but currently runs off the side of the page",
                     "when I compile my document.",
                     "How do I get this to wrap into paragraph form?"))

I personally recommend a more Latex-y solution. Basically, create the table environment in your tex file, add caption etc. Then, paste or \\input your stargazer output (with float = FALSE) in a minipage environment within the table environment, followed by your notes.

Ex:

\documentclass{article}
\begin{document}

\begin{table}
    \caption{Your Caption}
    \begin{minipage}{0.85\textwidth} 
        \begin{tabular}{|l|l|l|}
            \hline
            999 & 888 & 777 \\
            \hline
        \end{tabular} 
    \\
    \\
{ \footnotesize  Note: A very very long note that I would like to put below the table, but currently runs off the side of the page when I compile my document. How do I get this to wrap into paragraph form? \par} 
    \end{minipage}
\end{table}    

\end{document}

produces: https://i.stack.imgur.com/eCYy9.png

It's helpful to post a fully reproducible example as well. I know this is very old but the post still shows up in Google searches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM