crsh / papaja

papaja (Preparing APA Journal Articles) is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots.
https://frederikaust.com/papaja_man/
Other
657 stars 133 forks source link

YAML numbersections: true #85

Closed lnalborczyk closed 8 years ago

lnalborczyk commented 8 years ago

Hello,

not really an issue but I'd like to know how to "control" the section-numbering. I've added the following argument "numbersections: true" to the YAML header of a "papaja::apa6_pdf" Markdown file and surprisingly (or maybe not) section numbering starts at Abstract...

Thus, Abstract is numbered "1", then the next page containing the title of the file and a wordcount is numbered "2"... and, my first header in text (i.e., "#Introduction") appears to be numbered 3...

I would like to start section-numbering at "Introduction" (i.e., my first header in text). In other words, I'd like to "unnumber" Abstract and title.

Is there an easy way to do that ?

Thanks for your help and for the great work you did on this package.

Best regards,

Ladislas

crsh commented 8 years ago

Hi, after experimenting a bit with different approaches, the easiest thing I have found is setting numbersections: false and adding \setcounter{secnumdepth}{5} to the beginning of your document. Alternatively, you can install the current development snapshot (devtools::install_github("crsh/papaja", ref = "devel")) in which numbersections: true should just do what you expected.

lnalborczyk commented 8 years ago

It works perfectly, thanks a lot.

Ladislas

jrennstich commented 4 years ago

Unfortunately, when rendering man in the current version [0.1.0.994], the numbering starts with authornote (then abstract), with the first headline in body being numbered 3.

Works like a charm when rendering doc.

tfjaeger commented 2 years ago

This is an issue again (still?) in R 4.2.1, and the most recent CRAN version of papaja. Install the rdevel version (0.1.0.9999) does not seem to fix the issue.

(Amazing library, btw, it's been wonderful to have this)

mariusbarth commented 2 years ago

Hi @tfjaeger, I just tried to reproduce your issue, but at least on my machine (R 4.2.1 on ubuntu 20.04 with all packages up-to-date) everything works as expected (i.e., section numbering starts with the first header in the main body of the document).

Can you paste your output from sessionInfo() here?

GH-Jaeger commented 2 years ago

Thanks for the quick reply. To be clear, it works with the \setcounter{secnumdepth}{5} workaround. But without it, I get the numbering error. First, here's a minimal version of the doc that causes the issue:

---
title             : "title"
shorttitle        : "shorter title"
date              : "`r format(Sys.time(), '%B %d, %Y')`"

author: 
  - name          : "XX"
    affiliation   : "1,2"
    corresponding : yes    # Define only one corresponding author
    address       : "3151 Social Science Plaza B, University of California, Irvine CA 92697–5100"
    email         : "xx@uci.edu"

affiliation:
  - id            : "1"
    institution   : "Language Science, University of California, Irvine"
  - id            : "2"
    institution   : "Brain and Cognitive Sciences, University of Rochester"
  - id            : "3"
    institution   : "Computer Science, University of Rochester"

authornote: |
  We are grateful to ### ommitted for review ###

abstract: |
  Bliblablub

keywords          : "speech perception; computational model; accent adaptation; perceptual recalibration"
wordcount         : "X"

bibliography      : ["latex-stuff/library.bib", "latex-stuff/r-references.bib"]
link-citations    : yes
csl               : latex-stuff/apa-6th-edition.csl

floatsintext      : yes
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : yes
numbersections    : true
mask              : no
draft             : no

header-includes: 
 - \usepackage{animate}
 - \usepackage{amsmath}
 - \usepackage{tikz}
 - \usetikzlibrary{bayesnet}
 - \usepackage{booktabs}
 - \usepackage{siunitx}
 - \usepackage{soul}
 - \usepackage{tabto}
 - \usepackage{xcolor}
 - \usepackage{placeins}
 - \setstcolor{red}
 - \usepackage{sectsty}
 - \sectionfont{\color{black}}
 - \subsectionfont{\color{black}}
 - \subsubsectionfont{\color{black}}
 - \usepackage{setspace}\doublespacing
 - \usepackage{subfig}

documentclass     : "apa6"
classoption       : "man"
fontsize          : 11pt
output: 
  papaja::apa6_pdf:
    latex_engine: xelatex
    extra_dependencies: "subfig" 
    includes:
      in_header: latex-stuff/header.tex
always_allow_html: true
---

# START OF CHUNK HERE {r libraries, include=FALSE, message=FALSE}
library(curl)               # Check availability of internet for install of remote libraries
if (has_internet()) devtools::install_github("crsh/papaja")
library(papaja)             # APA formatted ms
# END OF CHUNK HERE (omitted for formatting reasons)

# First heading

And here's the session info:

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] papaja_0.1.1     tinylabels_0.2.3 curl_4.3.2      

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9        compiler_4.2.1    later_1.3.0       urlchecker_1.0.1  prettyunits_1.1.1
 [6] profvis_0.3.7     remotes_2.4.2     tools_4.2.1       digest_0.6.29     pkgbuild_1.3.1   
[11] pkgload_1.3.0     memoise_2.0.1     lifecycle_1.0.1   rlang_1.0.4       shiny_1.7.2      
[16] cli_3.3.0         rstudioapi_0.13   xfun_0.32         fastmap_1.1.0     stringr_1.4.1    
[21] knitr_1.40        vctrs_0.4.1       fs_1.5.2          htmlwidgets_1.5.4 devtools_2.4.4   
[26] glue_1.6.2        R6_2.5.1          processx_3.7.0    sessioninfo_1.2.2 purrr_0.3.4      
[31] callr_3.7.1       magrittr_2.0.3    ps_1.7.1          promises_1.2.0.1  ellipsis_0.3.2   
[36] htmltools_0.5.3   usethis_2.1.6     mime_0.12         xtable_1.8-4      httpuv_1.6.5     
[41] stringi_1.7.8     miniUI_0.1.1.1    cachem_1.0.6      crayon_1.5.1