Sto usando tufte-handout (http://mirrors.ibiblio.org/CTAN/macros/latex/contrib/tufte-latex/sample-handout.pdf) per creare un piccolo report in lattice. Ho un codice di file. Rnw che ho lavorato a maglia in code.tex. Qui di seguito è il mio code.Rnw:Come centrare l'output xtable di LaTeX nella larghezza del testo completo
\documentclass[12pt,english,nohyper]{tufte-handout}
\usepackage{longtable}
\usepackage{geometry}
\begin{document}
<<include=FALSE>>=
library(ggplot2)
library(xtable)
@
\centerline{\Large\bf This is my Main Title}
<<echo=FALSE,results='asis'>>=
fname='plot1.pdf'
pdf(fname,width=4,height=4)
print(qplot(mpg,cyl,data=mtcars))
{dev.off();invisible()}
cat(sprintf('\\begin{marginfigure}
\\includegraphics[width=0.98\\linewidth]{%s}
\\caption{\\label{mar:hist}MPG vs CYL in MTCARS dataset.}
\\end{marginfigure}',sub('\\.pdf','',fname)))
@
This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report.
This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report. This is the paragraph in my report.
\bigskip{}
<<echo=FALSE,results='asis'>>=
x.big <- xtable(mtcars[1:20,1:4], label ='tab:mtcars',caption ='This is the mtcar dataset head.',align = c("rr|lr|r"))
print(x.big, tabular.environment ='longtable', floating = FALSE, include.rownames=FALSE)
@
\end{document}
Questo produce il seguente output:
Quello che sto cercando di fare è quello di consentire l'uscita XTABLE (Tabella 1) essere centrato attraverso il testo intero. Di default, nel pacchetto tufte-handout, sembra centrare la tabella nel non margine sinistro.
Ho consultato diverse fonti, compresa quella indicata nella prima frase di questo post corrente. In base a tale riferimento, "Figure e tabelle a larghezza di pagina intera possono essere collocate negli ambienti figure * o table *." Non sono sicuro di come ottenerlo, visto che sto anche lavorando a questo rapporto.
Solo una nota per gli altri che questa soluzione potrebbe non funzionare come previsto se si utilizza \ usepackage {floatrow}. L'ho avuto nel mio preambolo e ho dovuto affrontare alcuni problemi. Una volta rimosso, ha funzionato bene. Grazie! – LanneR
Per chiunque fosse interessato, ho postato un follow-up per il post corrente. Poiché ho dovuto eliminare il \ usepackage {floatrow} per centrare la tabella, ho anche perso le funzioni desiderate con le figure e le didascalie. Ora sto provando a determinare come centrare con successo sia una tabella che una figura nella dispensa. Il post successivo in cui è stato esplorato si trova qui: http://stackoverflow.com/questions/31709966/how-to-center-latex-xtable-and-figure-output-in-full-text-width – LanneR