Giter Club home page Giter Club logo

pandoc-scholar's Introduction

pandoc-scholar

Note This project is no longer maintained: Some features explored here found their way into pandoc proper, while many others have been adopted by Quarto. If you are looking for a replacement, give Quarto a try! For the remaining pandoc-scholar features, as well as additional goodies, check the pandoc-ext organization.

release shield DOI license shield Build status

Create beautiful, semantically enriched articles with pandoc. This package provides utilities to make publishing of scientific articles as simple and pleasant as possible. It simplifies setting authors' metadata in YAML blocks, allows to add semantic annotation to citations, and only requires the programs pandoc and make.

Overview

Plain pandoc is already excellent at document conversion, but it lacks in metadata handling. Pandoc-scholar offers simple ways to include metadata on authors, affiliations, contact details, and citations. The data is included into the final output as document headers. Additionally all entries can be exported as JSON-LD, a standardized format for the semantic web.

The background leading to the development of pandoc-scholar is described in the paper published in PeerJ Computer Science.

Note that since version 2.0, most of the functionality of pandoc-scholar is now provided via pandoc Lua filters. If you prefer to mix-and-match selected functionalities provided by pandoc-scholar, you can now use the respective Lua filters directly. Integration with tools like RMarkdown is possible this way.

Demo

An example document plus bibliography is provided in the example folder. Running make in the example folder will process the example article, generating output like below:

example article screenshot

Get the full output as pdf, docx, or epub, or take a look at the metadata in JSON-LD format.

Usage via Docker

A very easy way to use pandoc-scholar is via Docker. The ready-made images contain all necessary software to generate a paper in multiple formats. This avoids any compatibility concerns; only Docker is required.

The official images are in the [pandocscholar/ubuntu] and [pandocscholar/alpine] images. The Alpine image is a bit smaller, while the Ubuntu image may be more familiar for people looking to extend the image. Both images come with pandoc, pandoc-citeproc, pandoc-crossref, and LaTeX.

Example call

Docker commands are often unwieldly due to the additional arguments. We recommend to define an alias or short script to simplify its use.

Given an article in file my-research-article.md and a simple Makefile like

ARTICLE_FILE = my-research-article.md
OUTFILE_PREFIX = out
include $(PANDOC_SCHOLAR_PATH)/Makefile

the conversion can be performed by running

docker run --rm -v "$(pwd):/data" -u "$(id -u)" pandocscholar/alpine

This will generate a set of files whose names all start with out.. Please be aware that existing files of the same name will be overwritten. The pandoc-scholar container calls make internally; additional commands and options can be passed by appending them the above command.

The images are based upon the official pandoc images; for more info and usage examples, see the pandoc/dockerfiles GitHub repo. The Docker images can easily be used in automatic document conversion pipelines; pandoc-actions-example gives a good overview.

A major difference between pandoc and pandoc-scholar images is that pandoc-scholar doesn't use pandoc but make as entrypoint. A basic Makefile must be present in the article directory when running pandoc-scholar.

Prerequisites

This package builds on pandoc, the universal document converter. See the pandoc website for installation instructions and suggestions for LaTeX packages, which we use for PDF generation.

Starting with pandoc-scholar 3.0.0, the minimum required pandoc version is 2.11. If you have to use an older pandoc, please combine it with the last 2.* release of pandoc-scholar.

Also note that pandoc's JATS support, especially citation handling, was buggy prior to pandoc v2.11.4. Please use that or a newer version when producing JATS XML.

Installation

Archives containing all required files are provided for each release. Use the release button above (or directly go to the latest release) and download a pandoc-scholar archive; both archive files, .zip and .tar.gz, contain the same files. Choose the filetype that is the easiest to unpack on you system.

A pandoc-scholar folder will be created on unpacking. The folder contains all required scripts and templates.

Usage

Quickstart

Run make to convert the example article into all supported output formats. The markdown file used to create the output files can be configured via the ARTICLE_FILE variable, either directly in the Makefile or by specifying the value on the command line.

make ARTICLE_FILE=your-file.md

Includable Makefile

The Makefile, which does most of the work, is written in a style that makes it simple to include it from within other Makefiles. This method allows to keep pandoc-scholar installed in a central location and to use the same instance for multiple projects. The ARTICLE_FILE and PANDOC_SCHOLAR_PATH variables must be defined in the including Makefile:

ARTICLE_FILE        = your-file.md
PANDOC_SCHOLAR_PATH = ../path-to-pandoc-scholar-folder
include $(PANDOC_SCHOLAR_PATH)/Makefile

Calling make as usual will create all configured output formats. Per default, this creates pdf, latex, docx, odt, epub, html, and jats output. The set of output files can be reduced by setting the DEFAULT_EXTENSIONS variable to a subset of the aforementioned formats. For example DEFAULT_EXTENSIONS = pdf odt docx

Alternative template files can be set using TEMPLATE_FILE_<FORMAT> variables, where <FORMAT> is one of HTML, EPUB, JATS, or LATEX. The reference files for ODT and DOCX output can be changed using ODT_REFERENCE_FILE and DOCX_REFERENCE_FILE, respectively.

Additional pandoc options can be given on a per-format basis using PANDOC_<FORMAT>_OPTIONS variables. The following uses an actual Makefile as an example to demonstrate usage of those options.

ARTICLE_FILE        = open-science-formatting.md

PANDOC_LATEX_OPTIONS  = --latex-engine=xelatex
PANDOC_LATEX_OPTIONS += --csl=peerj.csl
PANDOC_LATEX_OPTIONS += --filter=pandoc-citeproc
PANDOC_LATEX_OPTIONS += -M fontsize=10pt
PANDOC_LATEX_OPTIONS += -M classoption=fleqn

PANDOC_HTML_OPTIONS   = --toc
PANDOC_EPUB_OPTIONS   = --toc

DOCX_REFERENCE_FILE   = pandoc-manuscript.docx
ODT_REFERENCE_FILE    = pandoc-manuscript.odt
TEMPLATE_FILE_LATEX   = pandoc-peerj.latex

PANDOC_SCHOLAR_PATH = pandoc-scholar
include $(PANDOC_SCHOLAR_PATH)/Makefile

Metadata Features

Pandoc-scholar supports additional functionality via metadata fields. Most notably, the augmentation of articles with author and affiliation data, which is essential for academic publishing, is greatly simplified when using pandoc-scholar.

Authors and affiliations

Most metadata should be specified in the YAML block at the top of the article. Author data and affiliations are taken from the author and institute field, respectively. Institutes can be given via user-defined abbreviations, saving unnecessary repetitions while preserving readability.

Example:

author:
  - James Dewey Watson:
      institute: cavendish
  - Francis Harry Compton Crick:
      institute: cavendish
institute:
  - cavendish: Cavendish Laboratory, Cambridge

Authors are given in the order in which they are listed, while institute order follows from author order.

The separate institute field may add unwanted complexity in some cases. It is hence possible to omit it and to give the affiliations name directly in the author entry:

author:
  - John MacFarlane:
      institute: University of California, Berkeley

Institute address

Often it is not enough to give just a name for institutes. It is hence possible to add arbitrary fields. The name must then explicitly be set via the name field of the institute entry:

author:
  - Robert Winkler:
      institute: cinvestav
institute:
  - cinvestav:
      name: 'CINVESTAV Unidad Irapuato, Department of Biochemistry and Biotechnology'
      address: 'Km. 9.6 Libramiento Norte Carr. Irapuato-León, 36821 Irapuato Gto. México'
      phone: +52 (462) 623 9635

Currently only the institute's address is used in the default template, but future extensions will be based on this convention.

Semantic citations

Understanding the reason a citations is included in scholarly articles usually requires natural language processing of the article. However, navigating the current literature landscape can be improved and by having that information accesible and in a machine-readable form. Pandoc-scholar supports the CiTO ontology, allowing authors to specify important meta-information on the citation directly while writing the text. The property is simply prepended to the citation key, separated by a colon: @<property>:citationKey.

The following table contains all supported keywords and the respective CiTO properties. Authors are free to use the short-form, the full-length property, or any of the alternatives listed below (i.e., all word in a row denote the property and have the same effect).

CiTO property Keyword alternatives
agrees_with agrees_with agree_with
citation
cites
cites_as_authority authority as_authority
cites_as_data_source data_source as_data_source
cites_as_evidence evidence as_evidence
cites_as_metadata_document metadata as_metadata_document
cites_as_recommended_reading recommended_reading as_recommended_reading
disputes
documents
extends
includes_excerpt_from excerpt excerpt_from
includes_quotation_from quotation quotation_from
obtaines_background_from background background_from
refutes
replies_to
updates
uses_data_from data_from data
uses_method_in method method_in

Example:

DNA strands form a double-helix [@evidence:watson_crick_1953].

License

Copyright © 2016–2021 Albert Krewinkel and Robert Winkler except for the following components:

  • HTML template: © 2016 Andrew G. York and Diana Mounter
  • dkjson: © 2010-2013 David Heiko Kolf
  • lua-filters: © 2017-2021 Albert Krewinkel, John MacFarlane, and contributors.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

pandoc-scholar's People

Contributors

andrewheiss avatar benjamin-lee avatar davidki avatar floriandd2ba avatar geritwagner avatar gtuckerkellogg avatar jcolomb avatar jgm avatar jkr avatar jsta avatar mitchpaulus avatar nrdsp avatar pauliacomi avatar robinrosenstock avatar samhiatt avatar stain avatar svenevs avatar tarleb avatar tolot27 avatar tsibley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandoc-scholar's Issues

nil value error

I have the following Makefile:

ARTICLE_FILE        = book.md

PANDOC_LATEX_OPTIONS  = --latex-engine=lualatex
PANDOC_LATEX_OPTIONS += --csl=peerj.csl
PANDOC_LATEX_OPTIONS += --filter=pandoc-citeproc
PANDOC_LATEX_OPTIONS += -M fontsize=10pt
PANDOC_LATEX_OPTIONS += -M classoption=memoir

PANDOC_HTML_OPTIONS   = --toc
PANDOC_EPUB_OPTIONS   = --toc

DOCX_REFERENCE_FILE   = book.docx
ODT_REFERENCE_FILE    = book.odt

PANDOC_SCHOLAR_PATH = /home/bruce/Code/thirdparty/pandoc-scholar
include $(PANDOC_SCHOLAR_PATH)/Makefile

... and the following book.md:

% Book Title
% John Doe
% 2017

# Introduction

Something

## Subheading

More.

# Another

Something else.

... but get this error:

 make
pandoc --smart \
       -t /home/bruce/Code/thirdparty/pandoc-scholar/writers/affiliations.lua \
       --output outfile.enriched.json book.md
pandoc: user error (/home/bruce/Code/thirdparty/pandoc-scholar/scholarly-metadata/panlunatic.lua:126: attempt to concatenate a nil value)
make: *** [/home/bruce/Code/thirdparty/pandoc-scholar/Makefile:26: outfile.enriched.json] Error 1

I thought maybe the process was expecting a YAML metadata block, but that appears not to be the issue.

building the example fails: Deprecated pandoc-citeproc filter.

I have found this great project and trying so set it up.
But when building the example document (by running make in the example directory) I get a warning, telling Deprecated: pandoc-citeproc filter. Use --citeproc instead. and the building fails with Incompatible API versions: encoded with [1,22] but attempted to decode with [1,17,5,4].
When adjusting the file pandoc-options.inc.mk in line 4 to the following PANDOC_CITEPROC ?= --citeproc and in line 20 to PANDOC_WRITER_OPTIONS += $(PANDOC_CITEPROC) it is building successfully.

I am on Ubuntu 20.04 and pandoc 2.11.2

author-info-blocks throws an error under pandoc 2.3.1

Attempting to use the scholarly-metadata and author-info-blocks lua filters with pandoc version 2.3.1—the version currently shipping with RStudio—(and version 2.2.3.1) throws an error in the latter:

Error running filter ../author-info-blocks/author-info-blocks.lua:
Error while running filter function: ../author-info-blocks/author-info-blocks.lua:168: attempt to call a nil value (method 'map')

Reproducible example: the sample.md file included with the scholarly-metadata filter.

pandoc -f markdown sample.md -o sample.pdf --lua-filter=scholarly-metadata.lua --lua-filter=../author-info-blocks/author-info-blocks.lua

Any ideas?

Make returns an error

I did make as you wrote in README.md and I got the following error. What did I do wrong? The computer I am using is with Ubuntu 20.04.3 LTS.

pandoc
--lua-filter=/home/ishigohoka/Downloads/pandoc-scholar/lua-filters/cito/cito.lua --lua-filter=/home/ishigohoka/Downloads/pandoc-scholar/lua-filters/abstract-to-meta/abstract-to-meta.lua --lua-filter=/home/ishigohoka/Downloads/pandoc-scholar/lua-filters/scholarly-metadata/scholarly-metadata.lua
--to=json
--output=outfile.enriched.json example/article.md
Error running filter /home/ishigohoka/Downloads/pandoc-scholar/lua-filters/abstract-to-meta/abstract-to-meta.lua:
...cholar/lua-filters/abstract-to-meta/abstract-to-meta.lua:32: attempt to compare two table values
make: *** [Makefile:31: outfile.enriched.json] Error 83

Multiple auhors use "and" when Spanish is the language of the document

Hi again!

I centered again my eyes in the first page of my paper I have noticed that having more than one author, Pandoc Scholar (or Pandoc, I don't know exactly where is the bug) writes "and" instead of "y". The language of the document is well configured with lang: es and the authors are in this format:

author:
  - Iván Hernández-Cazorla:
      institute: wmes
      email: [email protected]
      orcid: 0000-0002-5436-8535
  - Manuel Ramírez-Sánchez:
      institute: iatext
      email: [email protected]
      orcid: 0000-0002-4935-7313
  - Gregorio Rodríguez-Herrera:
      institute: iatext
      email: [email protected]
      orcid: 0000-0002-9856-8897

and

Any idea about it? Thanks in advance!

Regards,
Iván

Rmarkdown integration

The lua filter of scholarly-metadata seem to be not working as expected in Rmarkdown, see #39, any clue what went wrong ?

Access date isn't in the bibliography

I use web resources in the paper I am writting so I need something that I think should be mandatory to cite web resource: the access date to the resource. I use Zotero to manage my reference and to export it in Better BibTeX format to use it in the markdown file.

But I don't know why this parameter, which in my bib file is urldate, is not in the bibliography. In the bibliography what I see is "Retrieved from", but no the date. Have you any idea about it? Could it be an issue of Pandoc Scholar or could it be of Pandoc itself? I check the APA style file I use and it is fine apparently.

P.S. Is there anyway in which I could translate the "Retrieve from" to the main language I use (Spanish)? In markdown file I have this:

header-includes: |
  \usepackage[spanish]{babel}

But it doesn't seem to work with the bibliography.

Title/subtitle field isn't printed in ODT/HTML file when it is formatted with latex

I am having an issue with the conversion of the title and subtitle field. Now that #28 is fixed, before to change it I check all the documents in all the formats. I am writing the subtitle with:

subtitle: \textit{subtitle}

The reason for this format is that I am using the subtitle field to write the title of the paper in English (original is in Spanish). If the title, or the subtitle, is written with this format it isn't printed in the ODT and HTML documents, but in the PDF is correct. In addition, I use this latex way to format the subtitle because I can't use markdown (* *) due it isn't fix the print of the field in both documents, and the PDF isn't printed fine at all (only print the body without the rest of the yaml fields).

So I ask you, could it be solved directly in the latex template used by Pandoc Scholar? I am thinking about this question, because it is possible that the best way is to create another conditional field in the latex template, like titleEnor titleTranslated, and give it the format in the template directly.

What do you think about? Does it happens for any special reason or it is directly inviable?

One more time, thank you for your efforts and your work!

Abstract should appear **after** author affiliation in docx

The abstract appears before the authors affiliation in docx documents, but it should appear after. I tried to do it and spent hours understanding how AST and lua filters work without finding a good solution.
I saw that authors affiliations and correspondence are positioned in the body using the author-info_blocks.lua filter, but the abstract is in meta. Would it be possible to keep affiliations and correspondence in meta so the abstract appears after ?

I tried to put the abstract back into the body, but then the template doe not recognize it as an abstract so it is wrongly formatted.

One similar solution is to not use the abstract-to-meta.lua filter and to put the abstract in the markdown file. But of course it yields the same output as the solution I tried before.

Unfortunately the abstract is most of the time formatted differently than the text from paragraphs in the templates from editors, so it is not a viable solution to put it in the body (unless we can format it the proper way).

docx is an important format for me to share the paper to colleagues that just want to use word as always before.

Could you take a look at that ?

use biblatex/biber for bibliography?

In my makefile I got

PANDOC_LATEX_OPTIONS  +=  --biblatex --pdf-engine=lualatex 
PANDOC_READER_OPTIONS = data/metadata.yaml
PANDOC_WRITER_OPTIONS  += --lua-filter=$(LUA_FILTERS_PATH)/short-captions/short-captions.lua  
PANDOC_WRITER_OPTIONS  += --standalone

in the yaml I have

bibliography: bib/bibliography.bib

I get the converted citation-commands like \autocite and I have \printbibliography at the end but it seems like biber is not run (the document is fine when I run it with latexmk).

Author and affiliation addresses

I would like add affiliation address to the title and author address to the corresponding author field (not just e-mail) and was wondering how this could be done.

Problems with curl getting scholarly-metadata

Hi,

I'm in China, where although github is not currently blocked, amazon aws redirection works very erratically. curl always fails to download (just hanging at 0%), which requires a ⌃c that breaks the makefile. Note that I can manually install this so it is a minor issue for me, but thought you should know.

wget handles the redirects fine. Perhaps there is a setting in curl that handles redirection better?

👉  make
curl --location --remote-name \
		https://github.com/pandoc-scholar/scholarly-metadata/releases/download//v1.1.0/scholarly-metadata.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   615    0   615    0     0    504      0 --:--:--  0:00:01 --:--:--   504
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:53 --:--:--     0^Cmake: *** [/Users/ian/Code/pandoc-scholar/scholarly-metadata] Interrupt: 2


👉  wget https://github.com/pandoc-scholar/scholarly-metadata/releases/download//v1.1.0/scholarly-metadata.tar.gz
--2017-06-16 10:50:39--  https://github.com/pandoc-scholar/scholarly-metadata/releases/download//v1.1.0/scholarly-metadata.tar.gz
Resolving github.com... 192.30.253.112, 192.30.253.113
Connecting to github.com|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/82491456/8c4642c6-4a1e-11e7-9cfc-81d0665db1bf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=us-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170616T025041Z&X-Amz-Expires=300&X-Amz-Signature=&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dscholarly-metadata.tar.gz&response-content-type=application%2Foctet-stream [following]
--2017-06-16 10:50:44--  https://github-production-release-asset-2e65be.s3.amazonaws.com/82491456/8c4642c6-4a1e-11e7-9cfc-81d0665db1bf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170616T025041Z&X-Amz-Expires=300&X-Amz-Signature=&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dscholarly-metadata.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com... 52.216.32.152
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com|52.216.32.152|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12456 (12K) [application/octet-stream]
Saving to: ‘scholarly-metadata.tar.gz’

scholarly-metadata.tar 100%[==========================>]  12.16K  29.0KB/s    in 0.4s

2017-06-16 10:50:46 (29.0 KB/s) - ‘scholarly-metadata.tar.gz’ saved [12456/12456]

Filter order prevents use of pandoc-fignos

When I added PANDOC_WRITER_OPTIONS += --filter pandoc-fignos to my Makefile, I was running into an issue exactly like this one. I was able to override it by going into pandoc-options.inc.mk and adding PANDOC_WRITER_OPTIONS += --filter pandoc-fignos to line 15.

Is there a more extensible/stable solution?

Getting --smart/-S has been removed. Use +smart or -smart extension instead

Not sure why, but getting the following error at compile time:

pandoc --smart \
           -t C://Pandoc-scholar/writers/affiliations.lua \
           --output doc.enriched.json body.md
--smart/-S has been removed.  Use +smart or -smart extension instead.
For example: pandoc -f markdown+smart -t markdown-smart.
Try pandoc --help for more information.
make: ** [doc.enriched.json] Error 2

Using pandoc-scholar on a Windows 10 machine with GnuWin32 .

Pandoc version is 2.0.6

documentation for newbies

Hi,
As ususal when first looking at such a project, I am lost as not being a linux user. It seems one can use it with Rmarkdown, can you give more information about how?
maybe, the best would be do have an example one can run (and test it on different machines...)

possibly add scholarly-metadata as git submodule?

So scholarly-metadata.inc.mk setups the scholarly-metadata subdirectory, using curl on the repo release.

If you're using git to keep the local repo up-to-date, this is maybe a little counter intuitive (at least it was for me); perhaps include as a submodule?

Subscript not working

Hi! I've updated your template document to include some of the more common symbols and notations that I require for my articles.

However, if I run your parser it doesn't successfully parse subscripts with the tilde symbol (e.g. CO~2~), but instead displays them normally in both html and pdf output, while the .latex file does have the proper \textsubscript tag. If I run plain pandoc manually, without the make file and your fancy lua parsers, it does parse the subscript correctly.

Example:

How does it handle 'quotes'? Are they nice and "curly"? What about
em-dashes---are they formatted correctly? And ranges? 5--12 should show me
what's what.

Can it do any superscripts^like\ this^? or subscripts~like\ this~?

Furthermore, I'm interested in *cursive* and **bold** and ***cursive bold?***
stuff.

And of course I want to know how it displays δ^13^C. Δ~47~? 

~2&nbsp;‰ VPDB. ~25.2(±3)&nbsp;℃

$x = \alpha x + \beta$

What about CO~2~? And CO~3~^2-^? 

Is this different from CO<sub>2</sub>? and CO<sub>3</sub><sup>2-</sup>?
Seems like latex doesn't pick it up then.

![Is this first figure numbered?](banana.jpg){#banana width=12cm}

see Fig. [1](#banana).

What about a table?

| these things | are all super | important |
|:-------------|:-------------:|----------:|
|  145         |             14|        oij|
| right?       | really        | though    |

Oh and by the way: is it possible to refer to figures the way we do it in LaTeX? Like see Fig.~\ref{fig:banana}, probably something like: see Fig. [ref?](#banana) such that it automatically creates a figure number?

is there any support for ORG markdown

org-mode markdown is powerful and is there any possibility to customize a bit the lua filters to be able support org syntax.
for example this an org test file

#+author: Arin^1,Arin^2
#+EMAIL: [email protected], [email protected]
#+TITLE: Your title goes here
#+SUBTITLE: SUB goes here
#+INSTITUTE: aa, bb, cc
#+DESCRIPTION: This document catalogs a set of tips and tricks for composing documents in Org mode.
#+KEYWORDS:  org-mode, syntax, quick reference, cheat sheet, recommended practices, latex, beamer, html
#+PANDOC_OPTIONS: reference-doc:template.docx
#+PANDOC_OPTIONS: lua-filter:raw-block.lua lua-filter:abstract-to-meta.lua

and using a simple lua filter to extract EMAIL author INSTITUTE variables and insert them into META block


-- intermediate store for variables and their values
local variables = {}

--- Function called for each raw block element.
function RawBlock (raw)
  -- Don't do anything unless the block contains *org* markup.
  if raw.format ~= 'org' then return nil end

  -- extract variable name and value
  local name, value = raw.text:match '#%+(%w+):%s*(.+)$'
  if name and value then
    variables[name] = value
  end
end

-- Add the extracted variables to the document's metadata.
function Meta (meta)
  for name, value in pairs(variables) do
    meta[name] = value
  end
  return meta

however, im stuck bit due to lack extensive knowledge of lua and pandoc! any suggestions?

"--smart/-S has been removed" error

Using pandoc 2.1.3 under macOS, the command

 make ARTICLE_FILE=example/article.md

fails and return the error:

--smart/-S has been removed.  Use +smart or -smart extension instead.
For example: pandoc -f markdown+smart -t markdown-smart.
Try pandoc --help for more information.
make: *** [outfile.enriched.json] Error 2

use separate metadata-yaml file

I was wondering how I could use a separate yaml file with the metadata?
e.g. in my makefile PANDOC_WRITER_OPTIONS = --metadata-file=data/metadata.yaml doesn’t work.

[Discussion] Inclusion of mighty_make into the project. Needs testing.

As discussed I updated the mighty_make to get closer to pandoc-scholar standards. Mighty_make is a makefile that tries to reduce the entry barrier of latex for scientists. It handles Latex installation, it checks latex dependencies installing them when needed, and of course the build of the document itself. For the document building it focus in separating three elements of document creation, the editor ones uses to write, the contents and the style. For the separation of contents and style, the approach I used was to predefine a directory structure. Whenever one drops a csl in the style directory, the makefile detects it and adds to the building targets. Whenever one drops a lua file in the style directory, it treats it as a filter including it into the pipeline. The same happens with docx and tex templates.

As far as I know, the makefile is completely includable. However I need help testing.

More than half of the commands should run in Windows (besides linux and MacOS). Needs testing.

So, perhaps we can discuss whether it is reasonable to incorporate this folder metaphor into pandoc-scholar. For example, if we organize jacs support in a style folder, mighty_make will be able to pick it up. And that can be done automatically as well, as I added a fetch command with which one can download a template directly from the command line, only pointing to the relevant github page.

Development of the tool is almost reaching all features I had in plan.

Suggestions are welcome, note that GNUMake is a hard language to read and takes getting used to it.

Last author "and" does not appear in html output

When compiling an html file, there does not appear to be an "and" before the last author. In the html template, a check exists for this:

...
$for(author)$
  $if(author.last)$and $endif$<span property="author" typeof="Person">
...

But there there is no property last unless written manually. Was this supposed to be added in one of the lua filters?

Disclaimer: I am not very familiar with pandoc templates.

Subtitle isn't inserted in PDF version

Hi!
First of all I want to thank to @tarleb and @robert-winkler for this awesome and useful tool. Now I am writting a paper and I think pandoc-scholar is suitable for my necessities and using it I save many time developing my own script. However I am having problems with the subtitle field.

I have the next YAML block:

---
title: Spanish title
subtitle: English title
author:
  - Iván Hernández-Cazorla:
      institute: abbrv
      email: [email protected]
      orcid: 0000-0000-0000-0000
institute:
  - abbrv: institution
resumen: 
abstract: |
  Abstract in Spanish
  \begin{center}
  \textbf{Keywords in Spanish}
  \end{center}
  \begin{center}
  \textbf{Abstract}
  \end{center}
  Abstract in English
  \begin{center}
  \textbf{Keywords in English}
  \end{center}
bibliography: bibliography.bib
csl: apa.csl
header-includes: |
  \usepackage[spanish]{babel}
...

The main problem is that the subtitle isn't being written in the PDF, but in the HTML it is fine. I don't know the reason. I tried to read the latex template used by pandoc-scholar but I dind't find nothing useful. One thing I tried was to replace the subtitle parts of the template by a subtitle mechanism I have in one script with a default.yaml block (using it without the header-includes: | of course):

---
header-includes: |
  \providecommand{\subtitle}[1]{%
  \usepackage{titling}
  \posttitle{%
    \par\large#1\end{center}}
  }
  \usepackage[spanish]{babel}
---

Anyone knows why it could be happening in this case? Could it be a bug of pandoc-scholar or is it totally related with my document? Ah, and note that I wrote the keywords in Spanish and English inside the abstract, it is due the keywords field doesn't work.

Regards

Issues with pandoc > 1.16 on Win 10

There are multiple isuues which I noted using it on Win10 with a pandoc version > 1.16:

If you are using Pandoc 2 then it complains ablout the --smart option (which seems to be removed/replaced)
Using 1.19 I get an error on pancod-citeproc (Permission denied).

Using 1.16 it works.
Unfortunately I am no pandoc/latex expert and could not find a solution to this.
Maybe it should at least be noted, that pandoc version should be 1.16

--pdf-engine=lualatex not possible

I take the default github-folder with the example file "article.md".
Instead of --pdf-engine=xelatex in pandoc-options.inc.mk I changed it to --pdf-engine=lualatex but I receive Error 43 and no PDF is produced.

Can you reproduce this behaviour?
I do like to use lualatex for various reasons.

Single author doesn't work properly in word

With one author listed in the metadata, the Word output has an extra , and before the author's name.

For example:
image

When the author field is listed as:

author:
  - Benjamin D. Lee:
      institute:
        - Lab41
        - HMS
        - SEAS
      email: [email protected]
      orcid: 0000-0002-7133-8397
      correspondence: "yes"

Generate Markdown output with all YAML aggregated

Hi!
I have a setup of an article with modular YAML meta data in three different files that I use in custom templates.

It would be great to have a Makefile rule to convert the Markdown to Markdown again with all YAML config aggregated in a single file.

The use case for this is that it would be easier to show and discuss the meta data set.

list of interesting features

I understand this project is no longer being developed.

  • the README says "If you are looking for a replacement, give Quarto a try!"
  • Also says "For the remaining pandoc-scholar features, as well as additional goodies, check the pandoc-ext organization"
    • However, there are only 6 filters in that org
    • I see a lot more interesting thigs here: https://github.com/pandoc-scholar/pandoc-scholar/tree/main/lua-filters
    • So is it possible to add to the README a list of features that are not present in Quarto? Or a comparison table listing these lua-filters, and the comparable page/feature on Quarto?
      That would be immensely useful to novices in the "scholarly pandoc" world. Thanks!!

Possibility to insert bibliography at specified position?

Is it possible to insert the bibliography in a specified position? i.e.:

---
title: this is the title
author: jones
...

# abstract

# introduction

# material and methods

# results

# references
< insert bibliography here >

# acknowledgements

# appendix

JSON parse error

Getting this error, not sure why:

  $> make
pandoc --standalone --filter=pandoc-citeproc \
               --pdf-engine=pdflatex --template=C://Pandoc-scholar/templates/pandoc-scholar.latex \
               --output article.latex article.enriched.json
JSON parse error
make: ** [article.latex] Error 64

latex ⇨ PDF compile fails — ifsym error

Hi, trying to make the example and the latex conversion to PDF fails (I don't see a latexmk log using make so I ran latexmk directly on the outfile.latex):

kpathsea: Running mktexpk --mfmode / --bdpi 600 --mag 0+480/600 --dpi 480 ifsym10
mktexpk: /usr/local/texlive/2017basic/texmf-dist/web2c/mktexdir ./texlive/2017basic/texmf-var/fonts/pk/ljfour/public/ifsym failed.
kpathsea: Appending font creation commands to missfont.log.

xdvipdfmx:warning: Could not locate a virtual/physical font for TFM "ifsym10".
xdvipdfmx:warning: >> There are no valid font mapping entry for this font.
xdvipdfmx:warning: >> Font file name "ifsym10" was assumed but failed to locate that font.
xdvipdfmx:fatal: Cannot proceed without .vf or "physical" font for PDF output...

Output file removed.
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  xdvipdfmx: Command for 'xdvipdfmx' gave return code 256

Using MacTeX 2017basic, ifsym is installed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.