In Pandoc, how do I add a newline between authors through the YAML metablock without modifying the template?

拟墨画扇 提交于 2019-12-08 08:03:59

问题


I am trying to add a a couple of authors to a report I am writing. Preferably, the second author would appear on a new line after the first. I know I can modify the template to add a new field or the multiple author example given in the Pandoc readme. However, I wonder if there is any character I can use to insert a new line between authors directly in the metablock. So far I have tried \newline, \\, | with newline and space, <br>, <div></div>, and making the author list a string with newline or double spaces between author names, but nothing has worked. My desired output is pdf.


回答1:


The problem isn't in the YAML metadata formatting (for which there are numerous ways to have multiline strings), but that the LaTeX \author command strips the newlines. But for PDF output (with LaTeX) you can do:

---
title: mytitle
author: '\protect\parbox{\textwidth}{\protect\centering Author: 1\\ Author: 2\\ Author 3}'
---

body text



回答2:


You can go with a simple list to achieve this.

---
title:  'Any title comes here'
author:
- Author One
- Author Two
---

Another way is to rely on the title block that has a slightly different syntax.

% Any title comes here
% author(s) (separated by semicolons)
% date

Find additional variants in the metadata-block section of the pandoc manual.



来源:https://stackoverflow.com/questions/32512790/in-pandoc-how-do-i-add-a-newline-between-authors-through-the-yaml-metablock-wit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!