-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with author information using authblk #1158
Comments
I believe this is because Pandoc templates does not conditionally insert This means that your tex file will have an extra empty \usepackage{lineno}
\usepackage{authblk}
%command for the package lineno
\linenumbers
%authors
\author[1]{Benicio del Ox}
\author[2]{Jake A. Motaungh}
\author[1]{Frederick P. Montego \thanks{fpm@insula.edu}}
\affil[1]{\footnotesize Department of Sociology, University of the Insula}
\affil[2]{\footnotesize Department of Psychology, University of Mars}
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\title{\textbf{A longitudinal analysis of Twitter trends in the year
2020}}
\usepackage{etoolbox}
\makeatletter
\providecommand{\subtitle}[1]{% add subtitle to \maketitle
\apptocmd{\@title}{\par {\large #1 \par}}{}{}
}
\makeatother
\subtitle{\emph{Political and sociological considerations}}
\author{}
\date{}
\begin{document} The last empty author cause the With bookdown, you could hack it as a workaround by setting the option Here is an example document: ---
title: '**A longitudinal analysis of Twitter trends in the year 2020**'
subtitle: _Political and sociological considerations_
output:
bookdown::pdf_document2:
keep_tex: TRUE
includes:
in_header: preamble.tex
---
```{cat, engine.opts = list(file = "preamble.tex")}
\usepackage{lineno}
\usepackage{authblk}
%command for the package lineno
\linenumbers
%authors
\author[1]{Benicio del Ox}
\author[2]{Jake A. Motaungh}
\author[1]{Frederick P. Montego \thanks{fpm@insula.edu}}
\affil[1]{\footnotesize Department of Sociology, University of the Insula}
\affil[2]{\footnotesize Department of Psychology, University of Mars}
```
```{r,setup}
remove_author <- function(x) {
# identify empty author line
i <- grep("^\\\\author\\{\\}$", x)
# be sure it is the one pandoc inserts
if(length(i) != 0 && grepl('^\\\\date\\{', x[i+1])) x <- x[-i]
x
}
options(bookdown.post.latex = remove_author)
```
# Header So it is not directly a rmarkdown issue but rather a template issue because you do not use the Also, a recent change in pandoc (jgm/pandoc@cc08868) put those fields now into preamble before header-includes. So in next version of Pandoc maybe this could help modify how author are rendered (don't really know) @yihui do you know where the You could use your own modified template if you want (building on the one in Pandoc, modifying this part, and passing a custom template using Hope it helps. Thanks for the report! |
Yes, it's from the empty As you mentioned, either using |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary. |
Hi! First time reporting an unexpected behavior. I have been using
Bookdown
to write a manuscript. To add the author information I did not use the pre-defined option fromBookdown
as there are multiple authors that have the same affiliation and using the default author information suggested byBookdown
would cause each author to have listed one affiliation, even if the affiliation is the same.What I have tried instead is to use the LaTeX package
authblk
to add the author information and affiliation. What I have now is apreamble.pty
file in the same directory where my manuscript.Rmd
file is. Thepreamble.pty
file contents are as follows:And here is a minimal reproducible example of the syntax I have in my
.Rmd
file:The error here is that when the document is compiled to a PDF an extra "and" appears at the end of the author list along with an affiliation superscript:
It is as if an additional author is expected on the author block. I have added more authors and author information and the issue persists, an addiional 'and' and a superscript appears at the end. I have been reading through a lot of forums but I have literally found no reason for this behavior. My only guess is that there is something in the LaTeX template from Pandoc that clashes with the
authblk
package. I also testedAnd got the same result. Literally, I am out of ideas of why this is happening. Of notice, I couldn't find any issues about something similar in tex.stackexchange, and the examples provided there seemed to indicate that
authblk
worked fine, which is why I am guessing that this has something to do with RMarkdown.My session info:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393), RStudio 1.4.1106
Locale:
LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
LC_MONETARY=English_United States.1252 LC_NUMERIC=C
LC_TIME=English_United States.1252
Package version:
base64enc_0.1.3 bookdown_0.22 compiler_4.1.0 digest_0.6.27 evaluate_0.14
glue_1.4.2 graphics_4.1.0 grDevices_4.1.0 highr_0.9 htmltools_0.5.1.1
jsonlite_1.7.2 knitr_1.33 magrittr_2.0.1 markdown_1.1 methods_4.1.0
mime_0.10 rlang_0.4.11 rmarkdown_2.8 rticles_0.19 stats_4.1.0
stringi_1.6.1 stringr_1.4.0 tinytex_0.31 tools_4.1.0 utils_4.1.0
xfun_0.23 yaml_2.2.1
The text was updated successfully, but these errors were encountered: