aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX.hs
AgeCommit message (Collapse)AuthorFilesLines
2020-09-02LaTeX reader: Factored out siunitx stuff into separate module.John MacFarlane1-223/+3
2020-08-15[Latex Reader] Fixing issues with \multirow and \multicolumn table cells (#6608)Laurent P. René de Cotret1-28/+48
* Added test to replicate (#6596) * Table cell reader not consuming spaces correctly (#6596) * Prevented wrong nesting of \multicolumn and \multirow table cells (#6603) * Parse empty table cells (#6603) * Support full prototype for multirow macro (#6603) Closes #6603
2020-08-14Change SIRange to SIrange (#6617)Emerson Harkin1-4/+4
2020-08-07[Latex Reader] Table cell parser not consuming spaces correctly (#6597)Laurent P. René de Cotret1-0/+2
* Added test to replicate (#6596) * Table cell reader not consuming spaces correctly (#6596)
2020-07-23Minimal support for SIRange in LaTeX reader (#6418)Emerson Harkin1-0/+24
Add support for `\SIRange{firstnumber}{secondnumber}{unit}` provided by siunitx. An en-dash is used instead of localized "to".
2020-07-23Col-span and row-span in LaTeX reader (#6470)Laurent P. René de Cotret1-19/+57
Add multirow and multicolumn support in LaTex reader. Partially addresses #6311.
2020-07-23Further improvements to ams theorem support, and a test.John MacFarlane1-2/+3
See #1608.
2020-07-23LaTeX reader: Add identifier in divs for ams theorem environments.John MacFarlane1-1/+1
2020-07-22LaTeX reader: SUpport ams `\theoremstyle`.John MacFarlane1-6/+28
2020-07-22Implement first optional argument for `\newtheorem`.John MacFarlane1-23/+30
This allows groups of theorem environments to be put in the same numbering sequence.
2020-07-22LaTeX reader: Don't boldface alt title in theorems.John MacFarlane1-2/+2
2020-07-22LaTeX reader: support theorem environments and `\newtheorem`.John MacFarlane1-3/+63
Includes numbering and labels and refs. Note that numbering support is not complete; we don't reset numbers with sections for example.
2020-07-22LaTeX reader: support ams proof environment.John MacFarlane1-0/+27
2020-07-22Moved more from LaTeX reader to LaTeX.Parsing.John MacFarlane1-63/+0
2020-07-20Move some code from T.P.R.LaTeX. to T.P.R.LaTeX.Parsing.John MacFarlane1-70/+14
We need to reduce the size of the LaTeX reader to ease compilation on resource-limited systems. More can be done in this vein.
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.