git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #3902 from adunning/euro

Write euro symbol directly in LaTeX

commita783a30661dac2d8bfe68ceb49d28f6630304304 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 8 Sep 2017, 16:28 (9 years ago) parent3421f3e621e43e
5 files changed+4−14
MANUAL.txt+1−2 data/templates/default.latex+1−6 src/Text/Pandoc/Writers/LaTeX.hs−6 test/writer.latex+1 test/writers-lang-and-dir.latex+1
MANUAL.txt+1−2
@@ -193,7 +193,7 @@ By default, pandoc will use LaTeX to convert it to PDF:
193193Production of a PDF requires that a LaTeX engine be installed (see
194194`--latex-engine`, below), and assumes that the following LaTeX packages
195195are available: [`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
196−[`ifxetex`], [`ifluatex`], [`eurosym`], [`listings`] (if the
196+[`ifxetex`], [`ifluatex`], [`listings`] (if the
197197`--listings` option is used), [`fancyvrb`], [`longtable`],
198198[`booktabs`], [`graphicx`] and [`grffile`] (if the document
199199contains images), [`hyperref`], [`xcolor`] (with `colorlinks`), [`ulem`], [`geometry`] (with the
@@ -226,7 +226,6 @@ will affect the output, as will `--css`.
226226[`lm`]: https://ctan.org/pkg/lm
227227[`ifxetex`]: https://ctan.org/pkg/ifxetex
228228[`ifluatex`]: https://ctan.org/pkg/ifluatex
229−[`eurosym`]: https://ctan.org/pkg/eurosym
230229[`listings`]: https://ctan.org/pkg/listings
231230[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
232231[`longtable`]: https://ctan.org/pkg/longtable
data/templates/default.latex+1−6
@@ -29,9 +29,7 @@ $endif$
2929\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
3030 \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
3131 \usepackage[utf8]{inputenc}
32−$if(euro)$
33− \usepackage{eurosym}
34−$endif$
32+ \usepackage{textcomp} % provides euro and other symbols
3533\else % if luatex or xelatex
3634$if(mathspec)$
3735 \ifxetex
@@ -46,9 +44,6 @@ $endif$
4644$for(fontfamilies)$
4745 \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}
4846$endfor$
49−$if(euro)$
50− \newcommand{\euro}{€}
51−$endif$
5247$if(mainfont)$
5348 \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
5449$endif$
src/Text/Pandoc/Writers/LaTeX.hs−6
@@ -82,7 +82,6 @@ data WriterState =
8282 , stHighlighting :: Bool -- true if document has highlighted code
8383 , stIncremental :: Bool -- true if beamer lists should be displayed bit by bit
8484 , stInternalLinks :: [String] -- list of internal link targets
85− , stUsesEuro :: Bool -- true if euro symbol used
8685 , stBeamer :: Bool -- produce beamer
8786 , stEmptyLine :: Bool -- true if no content on line
8887 }
@@ -111,7 +110,6 @@ startingState options = WriterState {
111110 , stHighlighting = False
112111 , stIncremental = writerIncremental options
113112 , stInternalLinks = []
114− , stUsesEuro = False
115113 , stBeamer = False
116114 , stEmptyLine = True }
117115
@@ -233,7 +231,6 @@ pandocToLaTeX options (Pandoc meta blocks) = do
233231 defField "lhs" (stLHS st) $
234232 defField "graphics" (stGraphics st) $
235233 defField "book-class" (stBook st) $
236− defField "euro" (stUsesEuro st) $
237234 defField "listings" (writerListings options || stLHS st) $
238235 defField "beamer" beamer $
239236 (if stHighlighting st
@@ -320,11 +317,8 @@ stringToLaTeX ctx (x:xs) = do
320317 rest <- stringToLaTeX ctx xs
321318 let ligatures = isEnabled Ext_smart opts && ctx == TextString
322319 let isUrl = ctx == URLString
323− when (x == '€') $
324− modify $ \st -> st{ stUsesEuro = True }
325320 return $
326321 case x of
327− '€' -> "\\euro{}" ++ rest
328322 '{' -> "\\{" ++ rest
329323 '}' -> "\\}" ++ rest
330324 '`' | ctx == CodeString -> "\\textasciigrave{}" ++ rest
test/writer.latex+1
@@ -9,6 +9,7 @@
99\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1010 \usepackage[T1]{fontenc}
1111 \usepackage[utf8]{inputenc}
12+ \usepackage{textcomp} % provides euro and other symbols
1213\else % if luatex or xelatex
1314 \usepackage{unicode-math}
1415 \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
test/writers-lang-and-dir.latex+1
@@ -9,6 +9,7 @@
99\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
1010 \usepackage[T1]{fontenc}
1111 \usepackage[utf8]{inputenc}
12+ \usepackage{textcomp} % provides euro and other symbols
1213\else % if luatex or xelatex
1314 \usepackage{unicode-math}
1415 \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}