Naereen / slides

All the slides of my talks since 2016! Written in LaTeX or Markdown, compiled to pretty PDF with pandoc :sparkles:, and experiments with Marp, reveal.js, remark.js etc. PDF on https://speakerdeck.com/naereen/ or on
https://perso.crans.org/besson/slides/
Other
15 stars 5 forks source link

Use a custom font for pandoc- and latex- generated slides (all or part) #6

Closed Naereen closed 6 years ago

Naereen commented 6 years ago

I'll like to use a custom (e.g., handwriting, as generated by this tool for instance) font for some part or the whole text of slides generated with LaTeX (or XeLaTeX) and also pandoc.

It shouldn't be too hard.

I would like to use "my own handwriting font" (with extra care to make it pretty :sparkles:) for the "Thank you" I insert at the end of every slideshows. It would make it more personal, but way "prettier" than if I just write it, scan it and use it as an image.

If this works, I can also use "my handwriting font" for, e.g., titles on a webpage, the acknowledgements in a article, legend in Matplotlib figures (à la XKCD).

See this SO question

Naereen commented 6 years ago

For instance, in CSS:

@font-face {
    font-family: "xkcd";
    src: url('Humor-Sans.ttf');
}
Naereen commented 6 years ago

See https://github.com/Naereen/My-Own-HandWritting-Font (work in progress)...

Naereen commented 6 years ago

With xelatex instead of pdflatex it shouldn't be too hard.

Naereen commented 6 years ago

Compilation:

latexmk -gg -pdf -pdflatex="xelatex %O %S" slides_169.tex

In LaTeX document

\ifxetex
\usepackage{fontspec}
\setmainfont[Ligatures=Historic]{TeX Gyre Pagella}
\newfontfamily\Fontify[Path = fonts/]{Fontify-Regular}
\fi

And in the last slide:

\begin{center}\begin{LARGE}
  \ifxetex
    {\Fontify Thanks!} \Smiley[1.2]
  \else
    \textbf{Thanks!} \Smiley[1.2]
  \fi
\end{LARGE}\end{center}
Naereen commented 6 years ago

my own handwritting font in xelatex slides