¿Ajuste de línea de notas de Stargazer?
Frecuentes
Visto 7,321 equipos
11
¿Hay alguna manera de conseguir 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?")
Que produce:
\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.
2 Respuestas
12
La 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?"))
Respondido 17 Feb 14, 21:02
It would be great if a future version of stargazer would put every such element of the vector into its own parbox as per Bryan's comment above. Breaking lines manually seems inelegant at the very least. - RoyalTS
Thanks, will consider. - user1953965
@user1953965 I would also prefer a function to wrap lines automatically, breaking lines does not really produce a beautiful table - bretauv
2
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.
por ejemplo:
\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}
produce: 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.
Respondido el 03 de junio de 20 a las 22:06
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas r latex stargazer or haz tu propia pregunta.
A quick fix is to use a
parbox
que se vería así:notes="\\parbox[t]{10cm}{Very long note goes here.}"
but may require manual changes if you adjust the models. - Bryan