![](/img/trans.png)
[英]Text justification with ragged2e inside a papaja-generated Rmarkdown
[英]Hold apa_table position in Rmarkdown/papaja
我確實有另一個 Rmarkdown/papaja package 問題,如果有人願意提供幫助,我會很高興:)
與互聯網上的許多人一樣,我無法控制我的桌子的 position。 我有
floatsintext: yes
YAML header 中包含的選項。 我知道有 LATEX 選項,例如 fig.pos = "!H" 我必須加載浮動 package
header-includes:
- usepackage\{float}
但是,這樣做我收到以下錯誤消息:
! LaTeX Error: Unknown float option `H'.
這告訴我浮動 package 無法加載我猜? (我確實安裝了 MacTex 以及最新的 R 版本)。
對我來說絕對令人困惑的是,當我離開默認間距時,表格(使用 app_table() 生成)出現在(大約)右側 position 中,但僅在我添加時出現在我的工作結束時
header-includes:
- \usepackage{setspace}
- \AtBeginEnvironment{tabular}{\singlespacing}
- \AtBeginEnvironment{lltable}{\singlespacing}
- \AtBeginEnvironment{tablenotes}{\singlespacing}
到 YAML header 以控制我的表格的間距。
我真的很感激任何幫助! 提前致謝!
編輯:我不知道這是否達到目的,但如果我創建以下選項,我的表格會出現在最后(而不是應該在哪里)
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
對於 PDF output,有一個推薦的方法來自定義通過apa_table()
創建的表的位置。 (您不必通過 header 加載float
package。)
首先,設置 YAML header 選項floatsintext: yes
。
其次,使用apa_table()
創建表時,請使用函數的placement
參數:
```{r tab}
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 = "H")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.