aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-06-23LaTeX reader: Retain the Div around tables with attributes.John MacFarlane1-1/+8
We'll need this to store table attributes until all writers are adjusted to react to attributes on the Table element.
2020-05-19LaTeX reader: don't parse beyond `\end{document}`.John MacFarlane1-13/+25
This required some internal changes to `\subfile` handling. Closes #6380.
2020-04-28Support new Underline element in readers and writers (#6277)Vaibhav Sagar1-3/+3
Deprecate `underlineSpan` in Shared in favor of `Text.Pandoc.Builder.underline`.
2020-04-17LaTeX reader: don't put surrounding Div around Table.John MacFarlane1-2/+5
This reverts a change in the last release; the Div is no longer needed, because we can now put the id right in the Table's attributes. However, writers may still need to be modified to do something with the id in a Table (e.g. create an anchor), so in the short term we may lose the ability to link to tables in some writers.
2020-04-15Use the new builders, modify readers to preserve empty headersdespresc1-5/+7
The Builder.simpleTable now only adds a row to the TableHead when the given header row is not null. This uncovered an inconsistency in the readers: some would unconditionally emit a header filled with empty cells, even if the header was not present. Now every reader has the conditional behaviour. Only the XWiki writer depended on the header row being always present; it now pads its head as necessary.
2020-04-15Adapt to the newest Table type, fix some previous adaptation issuesdespresc1-10/+10
- 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-12/+13
2020-04-07LaTeX reader: better handling of `\lettrine`.John MacFarlane1-1/+8
- SmallCaps instead of Span for the part after the initial capital. - Ensure that both arguments are parsed, so that in Markdown both are treated as raw LateX. (Closes #6258.)
2020-03-29Clean up some fmaps (#6226)Joseph C. Sible1-9/+9
* Avoid fmapping when we're just binding right after anyway * Clean up unnecessary fmaps in the LaTeX reader
2020-03-22Finer grained imports of Text.Pandoc.Class submodules (#6203)Albert Krewinkel1-4/+5
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-13A bit more cleanup (#6141)Joseph C. Sible1-22/+21
* Remove unnecessary fmaps and only do toMilliseconds once * Share the input tuple intead of making a new one * Lift return out of if * Simplify case statements * Lift DottedNum out of the case statements * Use st instead of mbs * Use setState instead of updateState now that we have the whole state around
2020-02-12LaTeX reader: improve caption and label parsing.John MacFarlane1-21/+32
- Don't emit empty Span elements for labels. - Put tables with labels in a surrounding Div.
2020-02-11LaTeX reader: resolve `\ref` to table numbers.John MacFarlane1-25/+41
Closes #6137.
2020-02-07Resolve HLint warningsAlbert Krewinkel1-3/+3
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-05LaTeX reader: skip comments in more places where this is needed.John MacFarlane1-17/+17
Closes #6114.
2020-02-03Allow & in LaTeX citation keys.John MacFarlane1-1/+1
Closes #6110.
2020-01-28Added a try that was needed for the commit fc78be1.John MacFarlane1-1/+1
The intent of that commit was to parse unknown LaTeX enivronments as verbatim if they can't be parsed normally, avoiding crashes on environments that allow unescaped underscores and the like. But the fix didn't completely work: it worked for raw TeX in markdown but not when reading LaTeX. This change fixes that. See #6034. Closes #6093.
2020-01-10LaTeX reader: allow beamer overlays for all commands in all raw tex.John MacFarlane1-10/+10
This affecs parsing of raw tex in LaTeX and in Markdown and other formats. Closes #6043.
2020-01-08LaTeX reader: improve parsing of raw environments.John MacFarlane1-1/+1
If parsing fails in a raw environment (e.g. due to special characters like unescaped `_`), try again as a verbatim environment, which is less sensitive to special characters. This allows us to capture special environments that change catcodes as raw tex when `-f latex+raw_tex` is used. Closes #6034.
2019-12-05Avoid deprecation warning for minimumDef using CPP.John MacFarlane1-1/+6
2019-11-21LaTeX reader: parse \micro siunitx unit command (#5921)Jose Luis Duran1-0/+1
This was somehow missed in 884aef31c55e375cd62fcb55a71829d005087cae.
2019-11-15LaTeX Reader: Add KOMA-Script metadata commands (#5910)Andrew Dunning1-1/+8
Add all titling commands to existing definition for `\dedication`.
2019-11-12Switch to new pandoc-types and use Text instead of String [API change].despresc1-166/+168
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-11-02LaTeX reader: Fixed dollar-math parsing...John MacFarlane1-9/+9
...to ensure that space is left between a control seq and a following word that would otherwise change its meaning. Closes #5836.
2019-11-02LaTeX untokenize: Ensure space between control sequence and following letter.John MacFarlane1-0/+1
Closes #5836.
2019-11-02LaTeX reader: Don't omit macro definitions defined in the preamble.John MacFarlane1-6/+7
These were formerly omitted (though they still affected macro resolution if `latex_macros` was set). Now they are included in the document.
2019-11-02LaTeX reader: parse macro defs as raw latex...John MacFarlane1-8/+13
when `latex_macros` is disabled. (When `latex_macros` is enabled, we omit them, since pandoc is applying the macros itself.) Previously, it was documented that the macro definitions got passed through as raw latex regardless of whether `latex_macros` was set -- but in fact they never got passed through.
2019-11-02LaTeX reader: fixed a hang/memory leak in certain circumstances.John MacFarlane1-3/+3
We were using `grouped blocks` instead of `grouped block`. This caused the reader to hang in an infinite loop (with a memory leak) on e.g. `\parbox{1em}{#1}`. Closes #5845.
2019-10-23T.P.Readers.LaTeX.Parsing: add `[Tok]` parameter to rawLaTeXParser.John MacFarlane1-6/+13
This allows us to avoid retokenizing multiple times in e.g. rawLaTeXBlock. (Unexported module, so not an API change.)
2019-09-28Use Prelude.fail to avoid ambiguity with fail from GHC.Base.John MacFarlane1-2/+2
2019-09-24LaTeX reader: Add 'tikzcd' to list of special environments.Eigil Rischel1-0/+1
This allows it to be processed by filters, in the same way that one can do for 'tikzpicture'
2019-09-02LaTeX reader: don't try to parse includes if raw_tex is set.John MacFarlane1-5/+13
When the `raw_tex` extension is set, we just carry through `\usepackage`, `\input`, etc. verbatim as raw LaTeX. Closes #5673.
2019-09-02LaTeX reader: properly handle optional arguments for macros.John MacFarlane1-1/+1
Closes #5682.
2019-08-27LaTeX reader: fix `\\` in `\parbox` inside a table cell.John MacFarlane1-3/+18
Closes #5711.
2019-08-05Treat `ly` as verbatim too (#5671)Urs Liska1-0/+1
According to https://github.com/jgm/pandoc/issues/4725#issuecomment-399772217 not only the `lilypond` environment but also `ly` should be included in the verbatim list. @jperon https://github.com/jperon/lyluatex/issues/203
2019-07-24LaTeX reader: handle `\passthrough` macro used by latex writer.John MacFarlane1-0/+2
Closes #5659.
2019-07-22LaTeX reader: support tex `\tt` command.John MacFarlane1-0/+1
Closes #5654.
2019-07-20LaTeX reader: search for image with list of extensions...John MacFarlane1-6/+16
like latex does, if an extension is not provided. Closes #4933.
2019-07-13Fix #4499: add mbox and hbox handling to LaTeX reader (#5586)Vasily Alferov1-1/+11
When `+raw_tex` is enabled, these are passed through literally. Otherwise, they are handled in a way that emulates LaTeX's behavior.
2019-07-13LaTeX reader: Properly handle \providecommand and environment...John MacFarlane1-21/+30
They are now ignored if the corresponding command or environment is already defined. Closes #5635.
2019-07-02Fix redundant constraint warnings. (#5625)Pete Ryland1-1/+1
2019-06-21Support epigraph command in LaTeX Reader.oquechy1-0/+8
Closes #3523.
2019-06-08LaTeX reader: pass through unknown listings language as class.John MacFarlane1-7/+13
Previously if the language was not in the list of listings- supported languages, it would not be added as a class, so custom syntax highlighting could not be used. Closes #5540.
2019-06-04Include trailing {}s in raw latex commands.John MacFarlane1-2/+7
Change is in rawLaTeXInline in LaTeX reader, but it affects the markdown reader and other readers that allow raw LaTeX. Previously, trailing `{}` would be included for unknown commands, but not for known commands. However, they are sometimes used to avoid a trailing space after the command. The chances that a `{}` after a LaTeX command is not part of the command are very small. Closes #5439.
2019-05-03LaTeX reader: Allow newlines in `\mintinline`.John MacFarlane1-3/+7
2019-04-10LaTeX reader: add braces when resolving `\DeclareMathOperator`.John MacFarlane1-1/+2
These seem to be needed for xelatex but not pdflatex. Closes #5441.
2019-03-10LaTeX reader: support `\underline`, `\ul`, `\uline` (#5359)Paul Tilley1-0/+5
These are parsed as a Span with class `underline`, as with other readers.
2019-03-07Add inNote to Footcite and FootcitesJohn MacFarlane1-2/+2