Skip to content

Instantly share code, notes, and snippets.

@matthiasbeyer
Created January 8, 2016 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthiasbeyer/193105fd42de66fdb1dd to your computer and use it in GitHub Desktop.
Save matthiasbeyer/193105fd42de66fdb1dd to your computer and use it in GitHub Desktop.
codelistings error with pandoc-crossref
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
\usepackage[sort]{natbib}
\usepackage{fancyhdr}
\usepackage{hyperref}
\usepackage{listings} % source code listings
\usepackage{longtable} % tables
\usepackage{booktabs} % tables
\usepackage{mathtools}
\usepackage{enumitem}
\providecommand{\tightlist}{ % pandoc wants this
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}
}
\oddsidemargin 0.2cm
\topmargin -1.0cm
\textheight 24.0cm
\textwidth 15.25cm
\parindent=0pt
\parskip 1ex
\renewcommand{\baselinestretch}{1.1}
\pagestyle{fancy}
$if(title)$
\lhead{\normalsize \textrm{$title$}}
$endif$
\chead{}
$if(version)$
\lfoot{\normalsize \textrm{$version$}}
$endif$
\cfoot{}
$if(date)$
\rfoot{$date$}
$endif$
\setlength{\fboxrule}{4pt}\setlength{\fboxsep}{2ex}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\begin{document}
\begin{center}
{\bf $title$}
\end{center}
$body$
\end{document}
#
#
#
# Variables
#
#
#
DOCUMENT_CLASS=article
SETTING_FONTSIZE=11pt
DOCUMENT_SETTINGS_PDF= \
--listings \
--variable fontsize=$(SETTING_FONTSIZE) \
--variable papersize=a4paper \
--variable classoption=cleardoublepage=empty \
--variable classoption=index=totoc \
--variable classoption=openright \
--variable classoption=final \
--variable classoption=listof=nochaptergap \
--variable documentclass=$(DOCUMENT_CLASS) \
--variable babel-lang=english \
--variable geometry=portrait
PANDOC=$(shell which pandoc)
PANDOC_PARAMS=-r markdown+simple_tables+table_captions+yaml_metadata_block+definition_lists+raw_html+markdown_in_html_blocks \
--filter pandoc-crossref
PANDOC_CC=$(PANDOC) $(PANDOC_PARAMS)
export PANDOC_CC_PDF=$(PANDOC) \
$(PANDOC_PARAMS) \
--latex-engine=pdflatex \
$(DOCUMENT_SETTINGS_PDF)
all:
@$(PANDOC_CC_PDF) \
--template ./default.latex \
test.md -o out.pdf
.PHONY: $(TARGET_PDF) $(TARGET_HTML)

title: example version: 0.1 date: January 2016 codeBlockCaptions: true figureTitle: "Figure" tableTitle: "Table" listingTitle: "Listing" titleDelimiter: ":" figPrefix:

  • "Figure"
  • "Figures" eqnPrefix:
  • "Equation"
  • "Equations" tblPrefix:
  • "Table"
  • "Tables" lstPrefix:
  • "Listing"
  • "Listings" secPrefix:
  • "Section"
  • "Sections" chapDelim: "." rangeDelim: "-" loftitle: "# List of Figures" lotTitle: "# List of Tables" lolTitle: "# List of Listings" ...

Code examples {#sec:codeexamples}

In @sec:codeexamples we show some code examples.

Listing: Foo

def foo():
    return 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment