mirror of
https://github.com/sdiehl/wiwinwlh.git
synced 2024-10-26 12:47:46 +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
|
LTEMPLATE = resources/page.latex
|
||||||
ETEMPLATE = resources/page.epubt
|
ETEMPLATE = resources/page.epubt
|
||||||
|
|
||||||
|
UNICODE_MAP = resources/unicodemapping.tex
|
||||||
|
|
||||||
FLAGS = --standalone --toc --toc-depth=2 --highlight-style pygments
|
FLAGS = --standalone --toc --toc-depth=2 --highlight-style pygments
|
||||||
LFLAGS = --top-level-division=chapter -V documentclass=book
|
LFLAGS = --top-level-division=chapter -V documentclass=book
|
||||||
HFLAGS = -c css/style.css -c css/layout.css
|
HFLAGS = -c css/style.css -c css/layout.css
|
||||||
@ -33,7 +35,7 @@ includes: includes.hs
|
|||||||
| $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) $(EFLAGS) -o $@
|
| $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) $(EFLAGS) -o $@
|
||||||
|
|
||||||
%.pdf: %.md includes
|
%.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:
|
clean:
|
||||||
-rm -f $(CHAPTERS) $(HTML) $(PDF) $(EPUB)
|
-rm -f $(CHAPTERS) $(HTML) $(PDF) $(EPUB)
|
||||||
|
@ -11,7 +11,6 @@ $if(linestretch)$
|
|||||||
$endif$
|
$endif$
|
||||||
\usepackage{amssymb,amsmath}
|
\usepackage{amssymb,amsmath}
|
||||||
\usepackage{ifxetex,ifluatex}
|
\usepackage{ifxetex,ifluatex}
|
||||||
\usepackage{fixltx2e} % provides \textsubscript
|
|
||||||
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
|
||||||
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
|
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
@ -25,6 +24,7 @@ $endif$
|
|||||||
\usepackage{fontspec}
|
\usepackage{fontspec}
|
||||||
\fi
|
\fi
|
||||||
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
|
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
|
||||||
|
\setmonofont{DejaVu Sans Mono}
|
||||||
$if(euro)$
|
$if(euro)$
|
||||||
\newcommand{\euro}{€}
|
\newcommand{\euro}{€}
|
||||||
$endif$
|
$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
|
let
|
||||||
pkgs = import nixpkgs { };
|
|
||||||
ghcWithDeps = pkgs.haskell.packages.${compiler}.ghcWithPackages
|
ghcWithDeps = pkgs.haskell.packages.${compiler}.ghcWithPackages
|
||||||
( ps: with ps; [ base pandoc containers ] );
|
( ps: with ps; [ base pandoc containers ] );
|
||||||
tex = with pkgs; texlive.combine {
|
tex = with pkgs; texlive.combine {
|
||||||
inherit (texlive)
|
inherit (texlive)
|
||||||
scheme-small
|
scheme-small
|
||||||
xetex
|
xetex
|
||||||
|
newunicodechar
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
fontsConf = makeFontsConf {
|
||||||
|
fontDirectories = [ dejavu_fonts ];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "wiwinwlh-env";
|
name = "wiwinwlh-env";
|
||||||
buildInputs = [ ghcWithDeps tex ];
|
buildInputs = [ ghcWithDeps tex ];
|
||||||
|
FONTCONFIG_FILE = fontsConf;
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
eval $(egrep ^export ${ghcWithDeps}/bin/ghc)
|
eval $(egrep ^export ${ghcWithDeps}/bin/ghc)
|
||||||
|
Loading…
Reference in New Issue
Block a user