aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/LaTeX.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-1/+1
- Writers.Native is now adapted to the new Table type. - Inline captions should now be conditionally wrapped in a Plain, not a Para block. - The toLegacyTable function now lives in Writers.Shared.
2020-04-15Implement the new Table typedespresc1-1/+2
2020-04-11LaTeX writer: ensure that `-M csquotes` works even in fragment mode.John MacFarlane1-10/+11
Closes #6265.
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-1/+1
This should speed-up recompilation after changes in `Text.Pandoc.Class`, as the number of modules affected by a change will be smaller in general. It also offers faster insights into the parts of `T.P.Class` used within a module.
2020-03-15Use implicit Prelude (#6187)Albert Krewinkel1-2/+0
* Use implicit Prelude The previous behavior was introduced as a fix for #4464. It seems that this change alone did not fix the issue, and `stack ghci` and `cabal repl` only work with GHC 8.4.1 or newer, as no custom Prelude is loaded for these versions. Given this, it seems cleaner to revert to the implicit Prelude. * PandocMonad: remove outdated check for base version Only base versions 4.9 and later are supported, the check for `MIN_VERSION_base(4,8,0)` is therefore unnecessary. * Always use custom prelude Previously, the custom prelude was used only with older GHC versions, as a workaround for problems with ghci. The ghci problems are resolved by replacing package `base` with `base-noprelude`, allowing for consistent use of the custom prelude across all GHC versions.
2020-03-13Update copyright year (#6186)Albert Krewinkel1-1/+1
* Update copyright year * Copyright: add notes for Lua and Jira modules
2020-02-14Fixes: group biblatex citations even with prefix and suffix (#6058)Ethan Riley1-25/+42
Closes #5849. Previously biblatex citations were only grouped if there was no prefix. This patch allows them to be grouped in subgroups split by prefixes and suffixes, which allows better citation sorting.
2020-02-07Apply linter suggestions. Add fix_spacing to lint target in Makefile.John MacFarlane1-4/+2
2020-02-07Resolve HLint warningsAlbert Krewinkel1-6/+5
All warnings are either fixed or, if more appropriate, HLint is configured to ignore them. HLint suggestions remain. * Ignore "Use camelCase" warnings in Lua and legacy code * Fix or ignore remaining HLint warnings * Remove redundant brackets * Remove redundant `return`s * Remove redundant as-pattern * Fuse mapM_/map * Use `.` to shorten code * Remove redundant `fmap` * Remove unused LANGUAGE pragmas * Hoist `not` in Text.Pandoc.App * Use fewer imports for `Text.DocTemplates` * Remove redundant `do`s * Remove redundant `$`s * Jira reader: remove unnecessary parentheses
2020-02-03Fix duplicate frame classes in LaTeX/Beamer output.John MacFarlane1-2/+2
Close #6107.
2020-01-07Fix regression in handling of columns in beamer slides.John MacFarlane1-5/+6
Columns in title slides were causing problems with slide division. Closes #6033.
2020-01-05Fix regression in beamer slide structure with certain slide levels.John MacFarlane1-8/+17
Closes #6030.
2020-01-01LaTeX writer: properly handle unnumbered headings level 4+.John MacFarlane1-1/+1
Closes #6018. Previously the `\paragraph` command was used instead of `\paragraph*` for unnumbered level 4 headings.
2019-11-27Remove redundant import.John MacFarlane1-1/+0
2019-11-27LaTeX writer - hlint.John MacFarlane1-29/+24
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-179/+193
PR #5884. + Use pandoc-types 1.20 and texmath 0.12. + Text is now used instead of String, with a few exceptions. + In the MediaBag module, some of the types using Strings were switched to use FilePath instead (not Text). + In the Parsing module, new parsers `manyChar`, `many1Char`, `manyTillChar`, `many1TillChar`, `many1Till`, `manyUntil`, `mantyUntilChar` have been added: these are like their unsuffixed counterparts but pack some or all of their output. + `glob` in Text.Pandoc.Class still takes String since it seems to be intended as an interface to Glob, which uses strings. It seems to be used only once in the package, in the EPUB writer, so that is not hard to change.
2019-10-29Changes to build with new doctemplates/doclayout.John MacFarlane1-2/+2
The new version of doctemplates adds many features to pandoc's templating system, while remaining backwards-compatible. New features include partials and filters. Using template filters, one can lay out data in enumerated lists and tables. Templates are now layout-sensitive: so, for example, if a text with soft line breaks is interpolated near the end of a line, the text will break and wrap naturally. This makes the templating system much more suitable for programatically generating markdown or other plain-text files from metadata.
2019-10-25Beamer writer: fix regression with hrules separating slides.John MacFarlane1-3/+3
2019-10-12LaTeX writer: fix horizontal rule.John MacFarlane1-1/+1
We change to use 0.5pt rather than `\linethickness`, which apparently only ever worked "by accident" and no longer works with recent updates to texlive. Closes #5801.
2019-10-10Make some writers sensitive to 'unlisted' class on headings.John MacFarlane1-4/+6
If this is present on a heading with the 'unnumbered' class, the heading won't appear in the TOC. This class has no effect if 'unnumbered' is not also specified. This affects HTML-based writers (including slide shows and epub), LateX (including beamer), RTF, and PowerPoint. Other writers do not yet support `unlisted`. Closes #1762.
2019-10-09Options.WriterOptions: Change type of writerVariables to Context Text.John MacFarlane1-3/+5
This will allow structured values. [API change]
2019-09-18LaTeX writer: use `\hspace{0pt}` for 0-width space U+200B.John MacFarlane1-0/+1
Closes #5756.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane1-152/+131
Text.Pandoc.Shared: + Remove `Element` type [API change] + Remove `makeHierarchicalize` [API change] + Add `makeSections` [API change] + Export `deLink` [API change] Now that we have Divs, we can use them to represent the structure of sections, and we don't need a special Element type. `makeSections` reorganizes a block list, adding Divs with class `section` around sections, and adding numbering if needed. This change also fixes some longstanding issues recognizing section structure when the document contains Divs. Closes #3057, see also #997. All writers have been changed to use `makeSections`. Note that in the process we have reverted the change c1d058aeb1c6a331a2cc22786ffaab17f7118ccd made in response to #5168, which I'm not completely sure was a good idea. Lua modules have also been adjusted accordingly. Existing lua filters that use `hierarchicalize` will need to be rewritten to use `make_sections`.
2019-09-02LaTeX writer: use `cslreferences` environment for csl bibliographies.John MacFarlane1-3/+18
this allows bibliographies to receive special formatting. The template now contains definition of this environment (enabled only when CSL is used). It also defines a `\cslhangindent` length. This is set to 2em by default when the bibliography style specifies a hanging indent. To override the length, you can use e.g. \setlength{\cslhangindent}{7em} in header-includes. Closes jgm/pandoc-citeproc#410.
2019-09-02LaTeX writer: strip off `{}` around locator for biblatex/natbib output.John MacFarlane1-1/+7
Closes #5722.
2019-08-25Use new doctemplates, doclayout.John MacFarlane1-55/+66
+ Remove Text.Pandoc.Pretty; use doclayout instead. [API change] + Text.Pandoc.Writers.Shared: remove metaToJSON, metaToJSON' [API change]. + Text.Pandoc.Writers.Shared: modify `addVariablesToContext`, `defField`, `setField`, `getField`, `resetField` to work with Context rather than JSON values. [API change] + Text.Pandoc.Writers.Shared: export new function `endsWithPlain` [API change]. + Use new templates and doclayout in writers. + Use Doc-based templates in all writers. + Adjust three tests for minor template rendering differences. + Added indentation to body in docbook4, docbook5 templates. The main impact of this change is better reflowing of content interpolated into templates. Previously, interpolated variables were rendered independently and intepolated as strings, which could lead to overly long lines. Now the templates interpolated as Doc values which may include breaking spaces, and reflowing occurs after template interpolation rather than before.
2019-08-14Add thin space when needed in LaTeX quote ligatures.John MacFarlane1-4/+9
Closes #5685.
2019-07-28Use doctemplates 0.3, change type of writerTemplate.John MacFarlane1-44/+15
* Require recent doctemplates. It is more flexible and supports partials. * Changed type of writerTemplate to Maybe Template instead of Maybe String. * Remove code from the LaTeX, Docbook, and JATS writers that looked in the template for strings to determine whether it is a book or an article, or whether csquotes is used. This was always kludgy and unreliable. To use csquotes for LaTeX, set `csquotes` in your variables or metadata. It is no longer sufficient to put `\usepackage{csquotes}` in your template or header includes. To specify a book style, use the `documentclass` variable or `--top-level-division`. * Change template code to use new API for doctemplates.
2019-07-20LaTeX writer: fix line breaks at start of paragraph.John MacFarlane1-9/+9
Previously we just omitted these. Now we render them using `\hfill\break` instead of `\\`. This is a revision of a PR by @sabine (#5591) who should be credited with the idea. Closes #3324.
2019-06-11LaTeX writer: Don't highlight code in headings.John MacFarlane1-3/+4
This causes compilation errors, and I don't know how to work around them. Closes #5574.
2019-06-10LaTeX writer: Use mbox to get proper behavior inside `\sout`.John MacFarlane1-6/+6
Closes #5529.
2019-06-07LaTeX writer: Include inline code attributes with `--listings`.John MacFarlane1-4/+12
Closes #5420.
2019-05-05LaTeX writer: don't produce columns environment unless beamer.John MacFarlane1-2/+2
The environment is beamer-only and as far as I'm aware there's no latex package that provides it for non-beamer use. Closes #5485.
2019-05-01Fix footnote in image caption.John MacFarlane1-10/+16
Regression! The fix for #4683 broke this case.
2019-04-05More fixes to beamer table footnotes.John MacFarlane1-14/+19
2019-04-05LaTeX writer: rename stInMinipage -> stExternalNotesJohn MacFarlane1-13/+14
2019-04-05Make footnotes work properly in beamer tables.John MacFarlane1-0/+6
This fixes a regression in beamer due to the fix to #5367. We put table footnotes outside the table in beamer, because footnote/footnotehyper don't work with beamer.
2019-03-29LaTeX writer: Avoid inadvertently creating ?` or !` ligatures.John MacFarlane1-0/+8
These are upside down ? and !, resp. Closes #5407.
2019-03-22LaTeX writer: Fix footnotes in table caption and cells.John MacFarlane1-13/+11
This fixes a bug wherein footnotes appeared in the wrong order, and with duplicate numbers, when in table captions and cells. We now use regular `\footnote` commands, even in the table caption and the minipages containing cells. Apparently longtable knows how to handle this. Closes #5367.
2019-03-18Improved fix to #5340 and added test.John MacFarlane1-2/+2
2019-03-18Improve autolink detection in LaTeX reader.John MacFarlane1-2/+2
This determines whether `\url` or `\href` is used. Closes #5340.
2019-03-04LaTeX writer: Add classes for frontmatter support (#5353)Andrew Dunning1-2/+2
Remove frontmatter from scrreprt The KOMA-Script `scrreprt` class follows the pattern of `report`, and does not support `\frontmatter`. Use frontmatter for more classes
2019-03-04LaTeX writer/template: better handling of front/main/backmatter.John MacFarlane1-26/+29
In pandoc 2.7 we assumed that every class with chapters would accept `\frontmatter`, `\mainmatter`, and `\backmatter`. This is not so (e.g. report does not). So pandoc 2.7 breaks on report class by including an unsupported command. So we replace the book-class variable in the template with two variables, has-chapters and has-frontmatter, and set these intelligently in the writer. Closes #5348.
2019-03-01LaTeX(Beamer) writer: include contents under headers < slidelevel.John MacFarlane1-1/+8
Currently we keep the fancy title slide and add a new slide with the same title and whatever content was under the header. This changes behavior of slides, but is consistent with the new behavior of the revealjs and other HTML slide show writers. See #4317.
2019-03-01Remove license boilerplate.John MacFarlane1-18/+0
The haddock module header contains essentially the same information, so the boilerplate is redundant and just one more thing to get out of sync.
2019-02-04Add missing copyright notices and remove license boilerplate (#5112)Albert Krewinkel1-2/+2
Quite a few modules were missing copyright notices. This commit adds copyright notices everywhere via haddock module headers. The old license boilerplate comment is redundant with this and has been removed. Update copyright years to 2019. Closes #4592.
2019-02-01LaTeX writer: use right fold for escapeString.John MacFarlane1-15/+13
This is more elegant than the explicit recursive we were using.
2019-02-01LaTeX writer: code simplification in escaping.John MacFarlane1-20/+21
2019-02-01LaTeX writer: avoid `{}` after control sequences when escaping.John MacFarlane1-26/+36
`\ldots{}.` doesn't behave as well as `\ldots.` with the latex ellipsis package. This patch causes pandoc to avoid emitting the `{}` when it is not necessary. Now `\ldots` and other control sequences used in escaping will be followed by either a `{}`, a space, or nothing, depending on context. Thanks to Elliott Slaughter for the suggestion.
2019-01-25LaTeX writer: add `#` special characeters for listings.John MacFarlane1-1/+1
This character needs special handling in lstinline. Closes #4939.