How to set all arguments of the Title line in manpage written in reStructuredText, converted to groff with pandoc - documentation

How can I get pandoc to properly set all of the arguments in the "Title line" (.TH) when converting from a .rst file to a man file?
According to the documentation man man-pages, the "Title line" takes positional arguments:
Title line
The first command in a man page should be a TH command:
.TH title section date source manual
The arguments of the command are as follows:
title The title of the man page, written in all caps (e.g., MAN-PAGES).
section
The section number in which the man page should be placed (e.g., 7).
date The date of the last nontrivial change that was made to the man page. (Within the man-pages project, the necessary up‐
dates to these timestamps are handled automatically by scripts, so there is no need to manually update them as part of a
patch.) Dates should be written in the form YYYY-MM-DD.
source The source of the command, function, or system call.
For those few man-pages pages in Sections 1 and 8, probably you just want to write GNU.
For system calls, just write Linux. (An earlier practice was to write the version number of the kernel from which the
manual page was being written/checked. However, this was never done consistently, and so was probably worse than in‐
cluding no version number. Henceforth, avoid including a version number.)
For library calls that are part of glibc or one of the other common GNU libraries, just use GNU C Library, GNU, or an
empty string.
For Section 4 pages, use Linux.
In cases of doubt, just write Linux, or GNU.
manual The title of the manual (e.g., for Section 2 and 3 pages in the man-pages package, use Linux Programmer's Manual).
I haven't found any documentation on how pandoc magically translates .rst files into groff files, but I've found that I can get it to spit-out a .TH line with a reStructuredText heading in the document like so:
user#buskill:~/tmp/groff$ cat source.rst
==========
my-program
==========
Synopsis
========
**my-program**
Description
===========
**my-program** is magical. It does what you need!
user#buskill:~/tmp/groff$
user#buskill:~/tmp/groff$ pandoc -s source.rst -t man
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "my-program" "" "" "" ""
.hy
.SH Synopsis
.PP
\f[B]my-program\f[R]
.SH Description
.PP
\f[B]my-program\f[R] is magical.
It does what you need!
user#buskill:~/tmp/groff$
The above execution shows that pandoc extracted the first argument to .TH from the reST heading (my-program), but the remaining arguments are all blank. If I try to specify them in the heading directly, it doesn't work.
user#buskill:~/tmp/groff$ head source.rst
==============================
my-program "one" "two" "three"
==============================
Synopsis
========
**my-program**
Description
user#buskill:~/tmp/groff$ pandoc -s source.rst -t man
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "my-program \[dq]one\[dq] \[dq]two\[dq] \[dq]three\[dq]" "" "" "" ""
.hy
.SH Synopsis
.PP
\f[B]my-program\f[R]
.SH Description
.PP
\f[B]my-program\f[R] is magical.
It does what you need!
user#buskill:~/tmp/groff$
What do I need to add to the source.rst file such that pandoc will populate the arguments in the destination file's .TH line? And, in general, where can I find reference documentation that describes this?

You can fix this by including the section in the title, defining the date in source.rst, and setting footer & header as variables.
Solution
Update your source.rst file as follows
========
one(two)
========
:date: three
Synopsis
========
**my-program**
Description
===========
**my-program** is magical. It does what you need!
And now re-render the manpage with the following command
user#buskill:~/tmp/groff$ pandoc -s source.rst --variable header=five --variable footer=four -t man
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "one" "two" "three" "four" "five"
.hy
.SH Synopsis
.PP
\f[B]my-program\f[R]
.SH Description
.PP
\f[B]my-program\f[R] is magical.
It does what you need!
user#buskill:~/tmp/groff$
Why this works
I couldn't find great reference documentation from pandoc for the conversion between .rst and man, so I solved this with trial-and-error.
First I found in the pandoc documentation that you can see a default template for the destination format using the -D argument
https://pandoc.org/MANUAL.html#templates
user#buskill:~$ pandoc -D man
$if(has-tables)$
.\"t
$endif$
$if(pandoc-version)$
.\" Automatically generated by Pandoc $pandoc-version$
.\"
$endif$
$if(adjusting)$
.ad $adjusting$
$endif$
.TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$" "$header/nowrap$"
$if(hyphenate)$
.hy
$else$
.nh
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$for(include-before)$
$include-before$
$endfor$
$body$
$for(include-after)$
$include-after$
$endfor$
$if(author)$
.SH AUTHORS
$for(author)$$author$$sep$; $endfor$.
$endif$
user#buskill:~$
I found that you can set the title and section by setting the main heading of the document to <title>(<section>).
And I found that you could set the date with a Field Name in source.rst
For some reason the formatting of the header and footer gets messed-up when defining them as field names, so I set those on the command line with
--variable header=five --variable footer=four

Related

Missing ".TH" section when converting .rst file to groff format in pandoc (reStructuredText, manpage)

What should I put in a source reStructuredText file to populate the "Title Heading" (.TH) line in the destination file when using pandoc to convert it to groff-format?
I have a python project whose documentation is built with sphinx. As such, most of the project's documentation is already written in reStructured Text (.rst files). I need to write a manpage, so I'd like to write it in reST format.
Unfortunately, when I use pandoc to convert the source .rst file to man (groff-format), the file doesn't render properly with man since it's missing the Title Heading.
For example, consider the following source file source.rst
==========
my-program
==========
----------------------
my-program description
----------------------
:manual section: 1
:manual group: John Doe
Synopsis
========
**my-program**
Description
===========
**my-program** is magical. It does what you need!
I use pandoc to convert it to groff format as follows:
user#disp117:~$ pandoc source.rst -t man > my-program.1
user#disp117:~$
user#disp117:~$ cat my-program.1
.SH my-program
.SS my-program description
.TP
manual section
1
.TP
manual group
John Doe
.SS Synopsis
.PP
\f[B]my-program\f[R]
.SS Description
.PP
\f[B]my-program\f[R] is magical.
It does what you need!
user#disp117:~$
Now, if I try to render that groff file, then it doesn't format properly.
user#disp117:~$ groffer --text my-program.1
manual section 1 manual group John Doe my‐program my‐program is
magical. It does what you need!
...
However, if I manually add the a .TH line to the file, then it works as expected.
user#disp117:~$ echo -e ".TH my_program(1)\n$(cat my-program.1)" > my-program.1
user#disp117:~$
user#disp117:~$ groffer --text my-program.1
my_program(1)() my_program(1)()
my-program
my-program description
manual section
1
manual group
John Doe
Synopsis
[B]my-program
[R]
Description
[B]my-program
[R] is magical. It does what you need!
my_program(1)()
user#disp117:~$
What do I need to add to source.rst such that pandoc will produce a file in groff-format that includes the .TH line?
Pandoc generates "snippets" by default; those snippets are intended to be integrated into a complete document. Make pandoc generate a complete document with
pandoc --standalone ...
or
pandoc -s ...

Rename ttf/woff/woff2 file to PostScript Font Name with Script

I am a typographer working with many fonts that have incorrect or incomplete filenames. I am on a Mac and have been using Hazel, AppleScript, and Automator workflows, attempting to automate renaming these files*. I require a script to replace the existing filename of ttf, woff, or woff2 files in Finder with the font's postscriptName. I know of tools (fc-scan/fontconfig, TTX, etc) which can retrieve the PostScript name-values I require, but lack the programming knowhow to code a script for my purposes. I've only managed to setup a watched directory that can run a script when any files matching certain parameters are added.
*To clarify, I am talking about changing the filename only, not the actual names stored within the font. Also I am open to a script of any compatible language or workflow of scripts if possible, e.g. this post references embedding AppleScript within Shell scripts via osascript.
StackExchange Posts I've Consulted:
How to get Fontname from OTF or TTF File?
How to get PostScript name of TTF font in OS X?
How to Change Name of Font?
Automate Renaming Files in macOS
Others:
https://github.com/dtinth/JXA-Cookbook/wiki/Using-JavaScript-for-Automation
https://github.com/fonttools/fonttools
https://github.com/devongovett/fontkit
https://www.npmjs.com/package/rename-js
https://opentype.js.org/font-inspector.html
http://www.fontgeek.net/blog/?p=343
https://www.lantean.co/osx-renaming-fonts-for-free
Edit: Added the following by request.
1) Screenshot of a somewhat typical webfont, illustrating how the form fields for font family and style names are often incomplete, blank, or contain illegal characters.
2) The woff file depicted (also, as base64).
Thank you all in advance!
Since you mentioned Automator in your question, I thought I'd try and solve this while using that to rename the file, along with standard Mac bash to get the font name. Hopefully, it beats learning a whole programming language.
I don't know what your workflow is so I'll leave any deviations to you but here is a method to select a font file and from Services, rename the file to the font's postscript name… based on Apple's metadata, specifically "com_apple_ats_name_postscript". This is one of the pieces of data retrieved using 'mdls' from the Terminal on the font file. To focus on the postscript name, grep the output for name_postscript. For simplicity here, I'll exclude the path to the selected file.
Font Name Aquisition
So… running this command…
mdls GenBkBasBI.ttf | grep -A1 name_postscript
… generates this output, which contains FontBook's Postscript name. The 'A1' in grep returns the found line and the first line after, which is the one containing the actual font name.
com_apple_ats_name_postscript = (
"GentiumBookBasic-BoldItalic"
Clean this up with some more bash (tr, tail)…
tr -d \ | tail -n 1 | tr -d \"
In order, these strip spaces, all lines excepting the last, and quotation marks. So for the first 'tr' instance, there is an extra space after the backslash.
In a single line, it looks like this…
mdls GenBkBasBI.ttf | grep -A1 name_postscript | tr -d \ | tail -n 1 | tr -d \"
…and produces this…
GentiumBookBasic-BoldItalic
Now, here is the workflow that includes the above bash command. I got the idea for variable usage from the answer to this question…
Apple Automator “New PDF from Images” maintaining same filename
Automator Workflow
Automator Workflow screenshot
At the top; Service receives selected 'files or folders' in 'Finder'.
Get Selected Finder Items
This (or Get Specified…) is there to allow testing. It is obviated by using this as a Service.
Set Value of Variable (File)
This is to remember which file you want to rename
Run Shell Script
This is where we use the bash stuff. The $f is the selected/specified file. I'm running 'zsh' for whatever reason. You can set it to whatever you're running, presumably 'bash'.
Set Value of Variable (Text)
Assign the bash output to a variable. This will be used by the last action for the new filename.
Get Value of Variable (File)
Recall the specified/selected file to rename.
Rename Finder Items: Name Single Item
I have it set to 'Basename only' so it will leave the extension alone. Enter the 'Text' variable from action 4 in here.

In texinfo, how to specify a bash single quote?

I am writing a package using the GNU build system. The documentation hence is in the texinfo format. As a result, executing make converts the texinfo file into the info format, and executing make pdf automatically produces a pdf file.
In the texinfo file, I have something like this:
#verbatim
awk '{...}' data.txt
#end verbatim
However, in the pdf, the "basic" single quotes (U+0027) in the awk command above are transformed into "curvy" single quotes (U+2019) so that, if one does a copy-paste of the command from the pdf into a terminal, bash complains ("syntax error"). This forces the user to edit the command he just copy-pasted. Same problem occurs if I replace #verbatim by #example. I searched the texinfo manual but couldn't find a way to specify apostrophes. I am using texinfo version 5.2.
Karl Berry (via the bug-texinfo mailing list) told me to add 2 lines to my texi file (more info):
#codequoteundirected on
#codequotebacktick on
as well as add the latest version of texinfo.tex to my package.

How to change header ("Contents") of automatic TOC when using Pandoc?

When converting markdown to pdf with pandoc (version 1.12.1) the ToC option adds an english header: "Contents".
Since my document is in Dutch, I would like to be able to put the Dutch equivalent of contents there. But unfortunately I couldn't find any configuration options for this, neither did I found clues in the default.latex file.
My query:
pandoc -S --toc essay.md --biblio "MCM Essay.bib" --csl apa.csl -o mcm.pdf
I'm using windows
I use MIKTex, like in the pandoc instructions
The string "Contents" is not supplied by pandoc, but by latex (which pandoc calls to create the PDF).
Try adding
-Vlang=dutch
to your command line. This will be passed to latex in the documentclass options, and LaTeX will provide the right string.
Adding
-V toc-title="My Custom TOC Header"
to the pandoc command line will also work. See https://pandoc.org/MANUAL.html#variables-set-automatically.

Pandoc and foreign characters

I've been trying to use Pandoc to convert some Markdown into a PDF file. This is a sample that Pandoc will not convert for me:
# Header!
## Sub Header
themselves derived respectively from the Greek ἀναρχία i.e. 'anarchy'
That's just something I grabbed from the top of the wikipedia database dump. Pandoc doesn't like that at all. This is the error message it gives me:
pandoc: Error producing PDF from TeX source.
! Package inputenc Error: Unicode char \u8:ἀ not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.53 ...es derived respectively from the Greek ἀ
Is there a command switch I can give it to get around this? I tried following the advice to do something like this, but it failed:
iconv -t utf-8 test.md | pandoc -o test.pdf
Update Before following John's advice below, see this.
Update 2 This is the command that ultimately got it working. Hopefully this will help someone:
pandoc test2.md -o test2.pdf --latex-engine=xelatex --template=my.latex --variable mainfont="DejaVu Serif" --variable sansfont=Arial
And this is the contents of my.latex:
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use microtype if available
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[utf]{inputenc}
\usepackage{ucs}
$if(euro)$
\usepackage{eurosym}
$endif$
\else % if luatex or xelatex
\usepackage{fontspec}
\ifxetex
\usepackage{xltxtra,xunicode}
\fi
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setromanfont{TeX Gyre Pagella}
\newcommand{\euro}{€}
$if(mainfont)$
\setmainfont{$mainfont$}
$endif$
$if(sansfont)$
\setsansfont{$sansfont$}
$endif$
$if(monofont)$
\setmonofont{$monofont$}
$endif$
$if(mathfont)$
\setmathfont{$mathfont$}
$endif$
\fi
$if(geometry)$
\usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
$endif$
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{plainnat}
$endif$
$if(biblatex)$
\usepackage{biblatex}
$if(biblio-files)$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
$if(tables)$
\usepackage{longtable}
$endif$
$if(graphics)$
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
\makeatletter
\def\maxwidth{\ifdim\Gin#nat#width>\linewidth\linewidth
\else\Gin#nat#width\fi}
\makeatother
\let\Oldincludegraphics\includegraphics
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
$endif$
\ifxetex
\usepackage[setpagesize=false, % page size defined by xetex
unicode=false, % unicode breaks when used with xetex
xetex]{hyperref}
\else
\usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true,
bookmarks=true,
pdfauthor={$author-meta$},
pdftitle={$title-meta$},
colorlinks=true,
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
pdfborder={0 0 0}}
\urlstyle{same} % don't use monospace font for urls
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
$if(numbersections)$
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$if(lang)$
\ifxetex
\usepackage{polyglossia}
\setmainlanguage{$mainlang$}
\else
\usepackage[$lang$]{babel}
\fi
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$if(title)$
\title{$title$}
$endif$
\author{$for(author)$$author$$sep$ \and $endfor$}
\date{$date$}
\begin{document}
$if(title)$
\maketitle
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
{
\hypersetup{linkcolor=black}
\setcounter{tocdepth}{$toc-depth$}
\tableofcontents
}
$endif$
$body$
$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
Use the --pdf-engine=xelatex option.
By default, Pandoc use the pdflatex engine when converting markdown file to pdf files. pdflatex can not handle Unicode characters very smoothly as xelatex. You should try xelatex instead. But, merely using xelatex command is not enough. As is often the case, you need to choose a proper font which contains glyphs for the Unicode characters your want to typeset.
I am a Chinese user, so take Chinese for example. If you have a test.md which contains the following content:
你好汉字
you can use the following command to compile this markdown file:
pandoc --pdf-engine=xelatex -V CJKmainfont="KaiTi" test.md -o test.pdf
In the above command, --pdf-engine=xelatex is used to select the LaTeX engine (for the new version of Pandoc, --latex-engine option is deprecated). -V CJKmainfont="KaiTi" is used to select the proper font which support Chinese. For other languages, you may use the flag -C mainfont="<FONT_NAME>".
How to find a font which support your language
In order to find a font which supports your language, you need to know your language code. Then, if you are on Linux system or on Windows systems with TeX Live installed. You can use the following command to find a valid font for you language:
fc-list :lang=zh #find the font which support Chinese (language code is `zh`)
The output on my Linux system is shown below
If you choose to use, e.g. the font Source Han Serif CN, then use the following command to compile your markdown file:
pandoc --pdf-engine=xelatex -V CJKmainfont="Source Han Serif CN" test.md -o test.pdf
UPDATE: the answer below seems to be valid for pandoc 1.x but with later versions the syntax has changed
Coming back to this post in five years time and the issue is still there. The command
pandoc -s test.md -t latex -o test.pdf
fails when test.md contains text with non-latin characters, Greek, Cyrillic, CJK, Hebrew and Arabic included.
LaTeX was designed before Unicode and its support for different character sets is robust in some areas but far from comprehensive, so the advice to use XeLaTeX is valid yet requires one to choose the main font carefully, since there is no automatic choice.
Below is a small taxonomy of possible issues and some solutions. All tested with Pandoc 1.19.
Cyrillic
Support for Cyrillic alphabet in LaTeX is provided via T2A font encoding.
Consider a small sample:
# Header
## Subheader
Tetris (Russian: Тетрис) quoting Wikipedia is a tile-matching puzzle
video game
Running this example with pandoc would fail with:
! Package inputenc Error: Unicode char Т (U+422)
(inputenc) not set up for use with LaTeX.
See the inputenc package documentation for explanation.
A fix is available as fontenc option is a predefined variable in default.latex template.
Running this example with
pandoc -t latex -o tetris.pdf -V fontenc=T2A cyrillic.md
would produce correct rendering
This however would not handle other language features correctly such as hyphenation. A better way would be to use Babel and have it select the correct font encoding.
pandoc -t latex -o tetris.pdf -V lang -V babel-lang=russian cyrillic.md
Or to switch languages with Babel commands inside Markdown
# Header
## Subheader
Tetris (Russian: \foreignlanguage{russian}{Тетрис}) quoting Wikipedia
is a tile-matching puzzle video game
And run with
pandoc -t latex -o tetris.pdf -V lang -V babel-lang=english \
-V babel-otherlangs=russian cyrillic2.md
Greek
The example in the original post contains characters both from the main and extended Greek Unicode codepages.
Anyway, the widely used LGR greek font encoding is not covered by LaTeX 3 project and is classified as a local encoding, i.e. it may vary from site to site and from system to system according to the LaTeX Encoding Guide.
On TeX Live the following packages need to be installed: texlive-greek-inputenc, texlive-greek-fontenc and texlive-cbfonts. Note that you need Babel 3.9 or later.
However the result of
pandoc -t latex -o anarchy.pdf -V fontenc=LGR greek.md
may appear unexpected.
In order to correct this issue one has to setup LaTeX Babel package correctly. And insert commands to switch between the languages in the original text:
# Header!
## Sub Header
themselves derived respectively from the Greek \textgreek{ἀναρχία}
i.e. 'anarchy'
Compiling this with the following command
pandoc -s greek2.md -t latex -V fontenc=T2A -V lang -V babel-lang=english \
-V babel-otherlangs=greek -o greek.pdf
would produce the output exactly as you would expect it to be:
XeLaTeX
All of this would not be needed if we were using XeLaTeX.
Just running the original example with
pandoc -s greek.md --latex-engine=xelatex -t latex -o greek.pdf
would produce
Because the font does not contain anything in the greek character positions the output contains some white space instead.
Selecting one of the popular fonts as the new mainfont would help a bit
pandoc -s greek.md --latex-engine=xelatex \
-V mainfont="Liberation Serif" -t latex -o greek.pdf
However characters from the extended Greek codepage such as the small letter alpha with psili accent are not rendered.
The Font Setup for Greek with XeTeX/LuaTeX Guide suggests to use DejaVu, Libertine or Free font families.
Indeed with DejaVu Serif, Linux Libertine O as well as Tempora and perhaps some other fonts, the result would be as expected. See below the rendering with XeLaTeX and Linux Libertine fonts.
pandoc -s greek.md --latex-engine=xelatex -V mainfont="Linux Libertine O" \
-t latex -o greek.pdf
Works for Cyrillic characters
pandoc myfile.md --pdf-engine=xelatex -V mainfont=Arial
You can use --latex-engine=xelatex, as said before, but the best I have found is to use the lang variable to specify the document language in the header, like this: lang: ru-RU. A working example on my debian workstation:
---
title: Lady Macbeth de Mzensk (Chostakovitch, livret d'Alexandre Preis, 1934)
lang: ru-RU
---
# Acte I / Tableau 1
*[Народ ненадежный]*
Ха, ха, ха, ха, ха, ха, ха. *[...]* Чуыствуем
На кого ты нас покидаешь?
Без хозяина будет скучно,
скучно, тоскливо, безрадостно.
Не работа. Без тебя невеселье. Воз вращайся
Как можно скорей, скорей !
Then you can launch:
$ pandoc -o your-file-output.pdf your-source-file.md
If you are using LaTeX intermediate output, then you can use inline \mbox{t\'ext} to get accented characters. Without the \mbox{}, the backslash often isn't interpreted correctly by the Pandoc parser.
I had a similar issue trying to get mathematical symbols to show up in the output.
As others have mentioned, with recent pandoc versions (v2.2.3.2 in my case) the option to use is pdf-engine=xelatex. I did not need to specify a font in this case:
pandoc -o MyDoc.pdf --pdf-engine=xelatex MyDoc.md
I did get an error that the latinmodern-math font was missing. I installed it using:
tlmgr install collection-fontsrecommended