mirror of
https://github.com/sdiehl/wiwinwlh.git
synced 2024-08-16 15:30:35 +03:00
Fixing missing unicode characters in rendered PDF (#177)
* Tweaking fonts to support unicode characters + making it pretty * Adding unicode mapping to math symbols for missing characters * Trying older ghc to fix the CI build issues
This commit is contained in:
parent
04a28b36ea
commit
8009d67678
4
Makefile
4
Makefile
@ -6,6 +6,8 @@ HTEMPLATE = resources/page.tmpl
|
||||
LTEMPLATE = resources/page.latex
|
||||
ETEMPLATE = resources/page.epubt
|
||||
|
||||
UNICODE_MAP = resources/unicodemapping.tex
|
||||
|
||||
FLAGS = --standalone --toc --toc-depth=2 --highlight-style pygments
|
||||
LFLAGS = --top-level-division=chapter -V documentclass=book
|
||||
HFLAGS = -c css/style.css -c css/layout.css
|
||||
@ -33,7 +35,7 @@ includes: includes.hs
|
||||
| $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) $(EFLAGS) -o $@
|
||||
|
||||
%.pdf: %.md includes
|
||||
./includes < $< | $(PANDOC) -c -s -f $(IFORMAT) --template $(LTEMPLATE) --pdf-engine=xelatex $(FLAGS) $(LFLAGS) -o $@
|
||||
./includes < $< | $(PANDOC) -c -s -f $(IFORMAT) --template $(LTEMPLATE) --include-in-header $(UNICODE_MAP) --pdf-engine=xelatex $(FLAGS) $(LFLAGS) -o $@
|
||||
|
||||
clean:
|
||||
-rm -f $(CHAPTERS) $(HTML) $(PDF) $(EPUB)
|
||||
|
@ -11,7 +11,6 @@ $if(linestretch)$
|
||||
$endif$
|
||||
\usepackage{amssymb,amsmath}
|
||||
\usepackage{ifxetex,ifluatex}
|
||||
\usepackage{fixltx2e} % provides \textsubscript
|
||||
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
@ -25,6 +24,7 @@ $endif$
|
||||
\usepackage{fontspec}
|
||||
\fi
|
||||
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
|
||||
\setmonofont{DejaVu Sans Mono}
|
||||
$if(euro)$
|
||||
\newcommand{\euro}{€}
|
||||
$endif$
|
||||
|
14
resources/unicodemapping.tex
Normal file
14
resources/unicodemapping.tex
Normal file
@ -0,0 +1,14 @@
|
||||
\newcommand{\sbullet}{%
|
||||
\texorpdfstring{\textsbullet}{\textbullet}%
|
||||
}
|
||||
\DeclareRobustCommand{\textsbullet}{%
|
||||
\unskip~\,\begin{picture}(1,1)(0,-3)\circle*{3}\end{picture}\ %
|
||||
}
|
||||
\usepackage{newunicodechar}
|
||||
\newunicodechar{⊥}{\ensuremath{\bot}}
|
||||
\newunicodechar{⊤}{\ensuremath{\top}}
|
||||
\newunicodechar{∨}{\ensuremath{\vee}}
|
||||
\newunicodechar{∧}{\ensuremath{\wedge}}
|
||||
\newunicodechar{⇒}{\ensuremath{\Rightarrow}}
|
||||
\newunicodechar{•}{\ensuremath{\sbullet}}
|
||||
\newunicodechar{λ}{\ensuremath{\lambda}}
|
@ -1,18 +1,22 @@
|
||||
{ nixpkgs ? <nixpkgs>, compiler ? "ghc843" }:
|
||||
{ pkgs ? import <nixpkgs> {}, compiler ? "ghc843" }: with pkgs;
|
||||
let
|
||||
pkgs = import nixpkgs { };
|
||||
ghcWithDeps = pkgs.haskell.packages.${compiler}.ghcWithPackages
|
||||
( ps: with ps; [ base pandoc containers ] );
|
||||
tex = with pkgs; texlive.combine {
|
||||
inherit (texlive)
|
||||
scheme-small
|
||||
xetex
|
||||
newunicodechar
|
||||
;
|
||||
};
|
||||
fontsConf = makeFontsConf {
|
||||
fontDirectories = [ dejavu_fonts ];
|
||||
};
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "wiwinwlh-env";
|
||||
buildInputs = [ ghcWithDeps tex ];
|
||||
FONTCONFIG_FILE = fontsConf;
|
||||
shellHook = ''
|
||||
export LANG=en_US.UTF-8
|
||||
eval $(egrep ^export ${ghcWithDeps}/bin/ghc)
|
||||
|
Loading…
Reference in New Issue
Block a user