【发布时间】:2021-08-13 13:09:58
【问题描述】:
我确实有另一个 Rmarkdown/papaja 包问题,如果有人愿意提供帮助,我会非常高兴:)
互联网上有很多人,我很难控制我的桌子的位置。 我有
floatsintext: yes
选项包含在 YAML 标头中。 我知道有诸如 fig.pos = "!H" 之类的 LATEX 选项,我必须为此加载 float 包
header-includes:
- usepackage\{float}
但是,这样做我收到以下错误消息:
! LaTeX Error: Unknown float option `H'.
这告诉我浮动包无法加载我猜? (我确实安装了 MacTex 以及最新的 R 版本)。
让我非常困惑的是,当我离开默认间距时,表格(使用 app_table() 生成)出现在(大约)正确的位置,但只在我添加时出现在我的工作结束时
header-includes:
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\singlespacing}
到 YAML 标头以控制我的表格的间距。
非常感谢任何帮助! 提前致谢!
编辑: 我不知道这是否达到目的,但如果我创建以下选项,我的表格会出现在最后(而不是它应该在的位置)
title : "TITLE"
shorttitle : "short title"
author:
- name : "me"
affiliation : "1"
corresponding : yes # Define only one corresponding author
address : "x"
email : "y"
role: # Contributorship roles (e.g., CRediT, https://casrai.org/credit/)
- Conceptualization
- Writing - Original Draft Preparation
- Writing - Review & Editing
# - name : "Ernst-August Doelle"
# affiliation : "1,2"
# role:
# - Writing - Review & Editing
affiliation:
- id : "1"
institution : ""
# - id : "2"
# institution : "Konstanz Business School"
authornote: |
Enter author note here.
abstract: |
keywords : "keywords"
wordcount : "X"
bibliography :
floatsintext : yes
figurelist : no
tablelist : no
footnotelist : no
linenumbers : no
mask : no
draft : no
csl: "apa.csl"
documentclass : "apa7"
classoption : "man"
output : papaja::apa6_pdf
toc: true
header-includes:
- \usepackage{float}
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\singlespacing}
---
{r setup, include = FALSE}
library("papaja")
library("apa")
library("tidyverse")
library("apaTables")
r_refs("r-references.bib")
{r analysis-preferences}
# Seed for random number generation
set.seed(42)
knitr::opts_chunk$set(cache.extra = knitr::rand_seed)
{r}
cor_table <- apa.cor.table(iris)
Text BLABLABLABLA
{r tab, results = "asis", fig.pos = "!h"}
apa_table(cor_table$table.body,
caption = "Means, standard deviations, and correlations with confidence intervals for study variables.",
note = "Note. M and SD are used to represent mean and standard deviation, respectively.Values in square brackets indicate the 95% confidence interval.The confidence interval is a plausible range of population correlations that could have caused the sample correlation (Cumming, 2014). * indicates p < .05. ** indicates p < .01.", font_size = "footnotesize", row.names = F,
placement = "p")
# Methods
We report how we determined our sample size, all data exclusions (if any), all manipulations, and all measures in the study. <!-- 21-word solution (Simmons, Nelson & Simonsohn, 2012; retrieved from http://ssrn.com/abstract=2160588) -->
## Participants
## Material
## Procedure
## Data analysis
We used `r cite_r("r-references.bib")` for all our analyses.
# Results
# Discussion
\newpage
# References
\begingroup
\setlength{\parindent}{-0.5in}
\setlength{\leftskip}{0.5in}
<div id="refs" custom-style="Bibliography"></div>
\endgroup
【问题讨论】:
-
你能发一个minimal reproducible example吗?
-
我编辑了帖子,抱歉我不知道创建可重现示例的其他方法。我必须删除 R 块之前的 `` 符号,因此必须将它们添加到结束.. 感谢您的回复!
-
如果你使用更多的反引号,你可以在你的代码中包含```,例如```` 将代码块嵌入到您的问题中。
标签: latex r-markdown papaja