我目前正致力于整理工作技术报告,我第一次使用Rmarkdown来创建这个pdf。我已经能够调试我遇到的很多问题,但是,有一个仍然无法解决我的问题,那就是在不影响周围文本格式的情况下插入表格。
我已经在下面添加了一个MWE(对不起提前告知长度,但它仍然会导致问题,但它会尽可能短)
我觉得我到处都是,我找不到有这个问题的其他人。我对任何类型的解决方案持开放态度,无论是乳胶格式化中的某些内容都需要更改,还是与表格放入文档的方式有关。到目前为止,我唯一的想法是在每个表之后添加分页符,但我感觉这会导致文档不能如期望的那样流畅。
修改 我已经成功地制作了一个MWE,用随机生成的单词段落替换了所有文本,这些段落与段落的实际长度非常接近,因为我可以在不拉动头发的情况下得到它们。所以基本上,忽略了文本,这一切都是胡言乱语。但是,我格式化了这个乱码,正如我的降价文档格式化,包括段落末尾的空格数和每个段落与代码块之间的行数。在此先感谢您的帮助。
---
title: "Table Issue MWE"
author: "me"
output:
pdf_document:
includes:
in_header: logo.tex
toc: no
html_document:
toc: yes
toc_float: yes
word_document:
toc: no
bibliography: bib1.bib
geometry: margin=1in
---
#Section 1
Fat son how smiling mrs natural expense anxious friends. Boy scale enjoy ask abode fanny being son. As material in learning subjects so improved feelings. Uncommonly compliment imprudence travelling insensible up ye insipidity. To up painted delight winding as brandon. Gay regret eat looked warmth easily far should now. Prospect at me wandered on extended wondered thoughts appetite to. Boisterous interested sir invitation particular saw alteration boy decisively.Supported neglected met she therefore unwilling discovery remainder. Way sentiments two indulgence uncommonly own. Diminution to frequently sentiments he connection continuing indulgence. An my exquisite conveying up defective. Shameless see the tolerably how continued. She enable men twenty elinor points appear. Whose merry ten yet was men seven ought balls. Is branched in my up strictly remember. Songs but chief has ham widow downs. Genius or so up vanity cannot. Large do tried going about water defer by. Silent son man she wished mother. Distrusts allowance do knowledge eagerness assurance additions to. Up unpacked friendly ecstatic so possible humoured do. Ample end might folly quiet one set spoke her. We no am former valley assure. Four need spot ye said we find mile. Are commanded him convinced dashwoods did estimable forfeited. Shy celebrated met sentiments she reasonably but. Proposal its disposed eat advanced marriage sociable. Drawings led greatest add subjects endeavor gay remember. Principles one yet assistance you met impossible. Style too own civil out along. Perfectly offending attempted add arranging age gentleman concluded. Get who uncommonly our expression ten increasing considered occasional travelling. Ever read tell year give may men call its. Piqued son turned fat income played end wicket. To do noisy downs round an happy books.Consulted he eagerness unfeeling deficient existence of. Calling nothing end fertile for venture way boy. Esteem spirit temper too say adieus who direct esteem. It esteems luckily mr or picture placing drawing no. Apartments frequently or motionless on reasonable projecting expression. Way mrs end gave tall walk fact bed.Rooms oh fully taken by worse do. Points afraid but may end law lasted. Was out laughter raptures returned outweigh.
1. One
2. Two
3. Three
4. Four
5. Five
Agreed joy vanity regret met may ladies oppose who. Mile fail as left as hard eyes. Meet made call in mean four year it to. Prospect so branched wondered sensible of up. For gay consisted resolving pronounce sportsman saw discovery not. Northward or household as conveying we earnestly believing. No in up contrasted discretion inhabiting excellence. Entreaties we collecting unpleasant at everything conviction. Surrounded affronting favourable no mr. Lain knew like half she yet joy. Be than dull as seen very shot. Attachment ye so am travelling estimating projecting is. Off fat address attacks his besides. Suitable settling mr attended no doubtful feelings. Any over for say bore such sold five but hung. It real sent your at. Amounted all shy set why followed declared. Repeated of endeavor mr position kindness offering ignorant so up. Simplicity are melancholy preference considered saw companions. Disposal on outweigh do speedily in on. Him ham although thoughts entirely drawings. Acceptance unreserved old admiration projection nay yet him. Lasted am so before on esteem vanity oh. Cordially convinced did incommode existence put out suffering certainly. Besides another and saw ferrars limited ten say unknown. On at tolerably depending do perceived. Luckily eat joy see own shyness minuter. So before remark at depart.
Fulfilled direction use continual set him propriety continued. Saw met applauded favourite deficient engrossed concealed and her. Concluded boy perpetual old supposing. Farther related bed and passage comfort civilly. Dashwoods see frankness objection abilities the. As hastened oh produced prospect formerly up am. Placing forming nay looking old married few has. Margaret disposed add screened rendered six say his striking confined. Perhaps far exposed age effects. Now distrusts you her delivered applauded affection out sincerity. As tolerably recommend shameless unfeeling he objection consisted. She although cheerful perceive screened throwing met not eat distance. Viewing hastily or written dearest elderly up weather it as. So direction so sweetness or extremity at daughters. Provided put unpacked now but bringing. Inhabit hearing perhaps on ye do no. It maids decay as there he. Smallest on suitable disposed do although blessing he juvenile in. Society or if excited forbade.
```{r, echo = F, results = "hide"}
#this chunk includes my required libraries
```
```{r, echo = F, results = "hide"}
#this chunk imports my data
```
```{r, echo = F, results = "hide"}
#This chunk does some tidying
```
```{r timeline, echo = F, fig.width = 14, fig.height=8, fig.align = "center", fig.cap = "Cordially convinced did incommode existence put out suffering certainly. Besides another and saw ferrars limited ten say unknown."}
x <- data.frame(Year = c(1986:2015),
y = rep(1))
library(ggplot2)
ggplot(x, aes(Year, y))+
geom_line(lineend = "butt", size = 1.5)+
theme_bw()
#this chunk creates a timeline - all actual annotation removed for simplicity
```
#2. Section 2
In on announcing if of comparison pianoforte projection. Maids hoped gay yet bed asked blind dried point. On abroad danger likely regret twenty edward do. Too horrible consider followed may differed age. An rest if more five mr of. Age just her rank met down way. Attended required so in cheerful an. Domestic replying she resolved him for did. Rather in lasted no within no. Way nor furnished sir procuring therefore but. Warmth far manner myself active are cannot called. Set her half end girl rich met. Me allowance departure an curiosity ye. In no talking address excited it conduct. Husbands debating replying overcame blessing he it me to domestic. Do to be agreeable conveying oh assurance. Wicket longer admire do barton vanity itself do in it. Preferred to sportsmen it engrossed listening. Park gate sell they west hard for the. Abode stuff noisy manor blush yet the far. Up colonel so between removed so do. Years use place decay sex worth drift age. Men lasting out end article express fortune demands own charmed. About are are money ask how seven.
```{r y1, echo = FALSE, fig.width = 12, fig.height=6, fig.align="center", warning=F, fig.cap="Cordially convinced did incommode existence put out suffering certainly. Besides another and saw ferrars limited ten say unknown. On at tolerably depending do perceived. Luckily eat joy see own shyness minuter. So before remark at depart."}
x <- data.frame(x = c(1:20), y = c(1:20))
ggplot(x, aes(x, y))+
geom_line()
```
Improve him believe opinion offered met and end cheered forbade. Friendly as stronger speedily by recurred. Son interest wandered sir addition end say. Manners beloved affixed picture men ask. Explain few led parties attacks picture company. On sure fine kept walk am in it. Resolved to in believed desirous unpacked weddings together. Nor off for enjoyed cousins herself. Little our played lively she adieus far sussex. Do theirs others merely at temper it nearer.
```{r x1, echo =F}
x <- data.frame(x = c("1992A", "1992B", "1997A", "1997B", "1998", "1999", "2002", "2005", "2008", "2011", "2014"),
y = c("Jan - June", "July - Dec", "Jan - June", "July - Dec", "June - Sept", "June - Sept",
"June - Sept", "June - Sept", "June - Sept", "June - Sept", "June - Sept"),
z = c(21.1, 15.0, 13.5, 11.0, 10.4, 9.4, 14.3, 9.9, 6.0, 6.9, 5.0))
colnames(x)[3] <- ""
library(pander)
pander(x, caption = " Men lasting out end article express fortune demands own charmed. About are are money ask how seven.")
```
```{r y2, echo = F, fig.width = 12, fig.height=6, fig.align="center", fig.cap="Cordially convinced did incommode existence put out suffering certainly. Besides another and saw ferrars limited ten say unknown. On at tolerably depending do perceived. Luckily eat joy see own shyness minuter. So before remark at depart."}
df1 <- data.frame(x = rnorm(1:100),
y = rnorm(1:100))
df2 <- data.frame(x = rnorm(1:100),
y = rnorm(1:100))
p1 <- ggplot(df1, aes(x, y))+
geom_point()+
geom_line()+
theme_bw()
p2 <- ggplot(df2, aes(x, y))+
geom_point()+
geom_line()+
theme_bw()
library(gridExtra)
grid.arrange(p1, p2, nrow = 1)
```
#3. Section 3
Improve him believe opinion offered met and end cheered forbade. Friendly as stronger speedily by recurred. Son interest wandered sir addition end say. Manners beloved affixed picture men ask. Explain few led parties attacks picture company. On sure fine kept walk am in it. Resolved to in believed desirous unpacked weddings together. Nor off for enjoyed cousins herself. Little our played lively she adieus far sussex. Do theirs others merely at temper it nearer.
```{r, echo = F}
#This chunk changes a character in a data.frame, has no output
```
##3.1 Section 3.1
Way nor furnished sir procuring therefore but. Warmth far manner myself active are cannot called. Set her half end girl rich met. Me allowance departure an curiosity ye. In no talking address excited it conduct. Husbands debating replying overcame blessing he it me to domestic.
```{r y3, echo = F, fig.width = 12, fig.height=5, fig.align= "center", fig.cap="Cordially convinced did incommode existence put out suffering certainly. Besides another and saw ferrars limited ten say unknown. On at tolerably depending do perceived."}
df3 <- data.frame(x = rnorm(1:100),
y = rep(c("first", "second")))
ggplot(df3, aes(x, y))+
geom_boxplot(fill = "grey80", color = "#3366FF")+
theme_bw()
```
Do to be agreeable conveying oh assurance. Wicket longer admire do barton vanity itself do in it. Preferred to sportsmen it engrossed listening. Park gate sell they west hard for the. Abode stuff noisy manor blush yet the far. Up colonel so between removed so do. Years use place decay sex worth drift age. Men lasting out end article express fortune demands own charmed. About are are money ask how seven. Improve him believe opinion offered met and end cheered forbade. Friendly as stronger speedily by recurred. Son interest wandered sir addition end say. Manners beloved affixed picture men ask. Explain few led parties attacks picture company. On sure fine kept walk am in it. Resolved to in believed desirous unpacked weddings together. Nor off for enjoyed cousins herself. Little our played lively she adieus far sussex. Do theirs others merely at temper it nearer. Meant balls it if up doubt small purse. Required his you put the outlived answered position. An pleasure exertion if believed provided to. All led out world these music while asked. Paid mind even sons does he door no. Attended overcame repeated it is perceive marianne in. In am think on style child of. Servants moreover in sensible he it ye possible.
Improve him believe opinion offered met and end cheered forbade. Friendly as stronger speedily by recurred. Son interest wandered sir addition end say. Manners beloved affixed picture men ask. Explain few led parties attacks picture company. On sure fine kept walk am in it. Resolved to in believed desirous unpacked weddings together. Nor off for enjoyed cousins herself. Little our played lively she adieus far sussex. Do theirs others merely at temper it nearer. Meant balls it if up doubt small purse. Required his you put the outlived answered position. An pleasure exertion if believed provided to. All led out world these music while asked. Paid mind even sons does he door no. Attended overcame repeated it is perceive marianne in. In am think on style child of. Servants moreover in sensible he it ye possible.
```{r x2, echo = F}
df <- data.frame(Comparison = "x vs y",
pvalue = 0.25)
colnames(df)[2] <- "p-value"
pander(df, caption = "Placing assured be if removed it besides on. Far shed each high read are men over day. Afraid we praise lively he suffer family estate is.")
```
Improve him believe opinion offered met and end cheered forbade. Friendly as stronger speedily by recurred. Son interest wandered sir addition end say. Manners beloved affixed picture men ask. Explain few led parties attacks picture company. On sure fine kept walk am in it. Resolved to in believed desirous unpacked weddings together. Nor off for enjoyed cousins herself. Little our played lively she adieus far sussex. Do theirs others merely at temper it nearer. Meant balls it if up doubt small purse. Required his you put the outlived answered position. An pleasure exertion if believed provided to. All led out world these music while asked. Paid mind even sons does he door no. Attended overcame repeated it is perceive marianne in. In am think on style child of. Servants moreover in sensible he it ye possible. Forfeited you engrossed but gay sometimes explained. Another as studied it to evident. Merry sense given he be arise. Conduct at an replied removal an amongst. Remaining determine few her two cordially admitting old. Sometimes strangers his ourselves her depending you boy. Eat discretion cultivated possession far comparison projection considered. And few fat interested discovered inquietude insensible unsatiable increasing eat.
```{r x3, echo = F}
x <- data.frame(x = c("1", "2", "3", "4", "5"),
y = c(420, 94, 250, 208, 105))
pander(x, caption = "And few fat interested discovered inquietude insensible unsatiable increasing eat.")
```
Placing assured be if removed it besides on. Far shed each high read are men over day. Afraid we praise lively he suffer family estate is. Ample order up in of in ready. Timed blind had now those ought set often which. Or snug dull he show more true wish. No at many deny away miss evil. On in so indeed spirit an mother. Amounted old strictly but marianne admitted. People former is remove remain as.
Fulfilled direction use continual set him propriety continued. Saw met applauded favourite deficient engrossed concealed and her. Concluded boy perpetual old supposing. Farther related bed and passage comfort civilly. Dashwoods see frankness objection abilities the. As hastened oh produced prospect formerly up am. Placing forming nay looking old married few has. Margaret disposed add screened rendered six say his striking confined.
Perhaps far exposed age effects. Now distrusts you her delivered applauded affection out sincerity. As tolerably recommend shameless unfeeling he objection consisted. She although cheerful perceive screened throwing met not eat distance. Viewing hastily or written dearest elderly up weather it as. So direction so sweetness or extremity at daughters. Provided put unpacked now but bringing.
与此文档关联的LaTeX文件是logo.tex:
\usepackage{titling}
\pretitle{%
\begin{center}
\LARGE
\includegraphics[width=4cm,height=6cm]{logo.png}\\[\bigskipamount]
}
\posttitle{\end{center}}
和bib1.bib:
@misc{source1,
author = "author",
title = "title"
}
(我在我的.bib
文件中有实际的引用,但是,因为我不认为这是问题所以我没有包含它们。)
MWE Page 3此图显示了问题首次出现的工作示例的第三页。文档中缺少大约16行文本。但是,就像在我的实际文档中一样,一些表实际上可以工作,如本例的第5页所示,如下所示:Tables working correctly
希望这更有帮助。