aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX.hs
AgeCommit message (Collapse)AuthorFilesLines
2017-08-25LaTeX reader: improved support for \hyperlink, \hypertarget.John MacFarlane1-6/+23
Closes #2549.
2017-08-24LaTeX reader: RN and Rn, from biblatex (#3854)bucklereed1-1/+29
2017-08-20LaTeX reader: Set identifiers on Spans used for \label.John MacFarlane1-1/+2
2017-08-20LaTeX reader: allow `]` inside group in option brackets.John MacFarlane1-3/+2
Closes #3857.
2017-08-18LaTeX reader: implement \newtoggle, \iftoggle, \toggletrue|falseJohn MacFarlane1-5/+47
from etoolbox. Closes #3853.
2017-08-17LaTeX reader: support \lq, \rq.John MacFarlane1-0/+2
2017-08-17LaTeX reader: support \textquoteleft|right, \textquotedblleft|right.John MacFarlane1-0/+4
Closes #3849.
2017-08-16LaTeX reader: rudimentary support for `\hyperlink`.John MacFarlane1-0/+4
2017-08-16LaTeX reader: use Link instead of Span for `\ref`.John MacFarlane1-5/+6
This makes more sense semantically and avoids unnecessary Span [Link] nestings when references are resolved.
2017-08-16LaTeX reader: add Support for `glossaries` and `acronym` package (#3589)schrieveslaach1-0/+39
Acronyms are not resolved by the reader, but acronym and glossary information is put into attributes on Spans so that they can be processed in filters.
2017-08-13Better handle complex \def macros as raw latex.John MacFarlane1-9/+11
2017-08-13LaTeX reader: Allow @ as a letter in control sequences.John MacFarlane1-2/+8
@ is commonly used in macros using `\makeatletter`. Ideally we'd make the tokenizer sensitive to `\makeatletter` and `\makeatother`, but until then this seems a good change.
2017-08-13LaTeX reader: fix `\let\a=0` case, with single character token.John MacFarlane1-13/+18
2017-08-13Resolve references to section numbers in LaTeX reader.John MacFarlane1-3/+17
2017-08-13LaTeX reader: track header numbers and correlate with labels.John MacFarlane1-22/+49
2017-08-13Put content of \ref, \label commands into span… (#3639)schrieveslaach1-3/+17
* Put content of `\ref` and `\label` commands into Span elements so they can be used in filters. * Add support for `\eqref`
2017-08-12LaTeX reader: Fixed space after \figurename etc.John MacFarlane1-4/+1
2017-08-12LaTeX reader: support \chaptername, \partname, \abstractname, etc.John MacFarlane1-0/+20
See #3559. Obsoletes #3560.
2017-08-12LaTeX reader: have `\setmainlanguage` set `lang` in metadata.John MacFarlane1-4/+6
2017-08-11Added support for translations (localization) (see #3559).John MacFarlane1-2/+133
* readDataFile, readDefaultDataFile, getReferenceDocx, getReferenceODT have been removed from Shared and moved into Class. They are now defined in terms of PandocMonad primitives, rather than being primitve methods of the class. * toLang has been moved from BCP47 to Class. * NoTranslation and CouldNotLoudTranslations have been added to LogMessage. * New module, Text.Pandoc.Translations, exporting Term, Translations, readTranslations. * New functions in Class: translateTerm, setTranslations. Note that nothing is loaded from data files until translateTerm is used; setTranslation just sets the language to be used. * Added two translation data files in data/translations. * LaTeX reader: Support `\setmainlanguage` or `\setdefaultlanguage` (polyglossia) and `\figurename`.
2017-08-09LaTeX reader: Use `label` instead of `data-label` for label in caption.John MacFarlane1-1/+1
See d441e656db576f266c4866e65ff9e4705d376381, #3639.
2017-08-07Small tweak to previous commit.John MacFarlane1-1/+1
2017-08-07LaTeX reader: Support simple `\def` macros.John MacFarlane1-2/+21
Note that we still don't support macros with fancy parameter delimiters, like \def\foo#1..#2{...}
2017-08-07LaTeX reader: Support `\let`.John MacFarlane1-13/+28
Also, fix regular macros so they're expanded at the point of use, and NOT also the point of definition. `\let` macros, by contrast, are expanded at the point of definition. Added an `ExpansionPoint` field to `Macro` to track this difference.
2017-08-05LaTeX reader: plainbreak, fancybreak et al from the memoir class (#3833)bucklereed1-0/+9
2017-07-25Merge branch 'textcolor-support' of https://github.com/schrieveslaach/pandoc ↵John MacFarlane1-0/+20
into schrieveslaach-textcolor-support
2017-07-24LaTeX reader: support etoolbox's ifstrequal.John MacFarlane1-0/+13
2017-07-24LaTeX reader: removed code for non-exported 'macro'.John MacFarlane1-8/+0
2017-07-24LaTeX reader: Removed 'macro'.John MacFarlane1-1/+0
It is no longer necessary, since the rawLaTeXBlock parser will parse macro definitions. This also avoids the need for a separate latexMacro parser in the Markdown reader.
2017-07-24LaTeX reader: some improvements in macro parsing.John MacFarlane1-19/+19
Fixed applyMacros so that it operates on the whole string, not just the first token! Don't remove macro definitions from the output, even if Ext_latex_macros is set, so that macros will be applied. Since they're only applied to math in Markdown, removing the macros can have bad effects. Even for math macros, keeping them should be harmless.
2017-07-24Refactored some common code in LaTeX reader.John MacFarlane1-37/+15
2017-07-21LaTeX reader: improved heuristic for raw block/inline.John MacFarlane1-2/+18
An unknown command at the beginning of the line that could be either block or inline is treated as block if we have a sequence of block commands followed by a newline or a `\startXXX` command (which might start a raw ConTeXt environment).
2017-07-21LaTeX reader: handle optional args in raw `\titleformat`.John MacFarlane1-8/+15
Closes #3804.
2017-07-19LaTeX reader: fixed regression with starred environment names.John MacFarlane1-14/+3
Closes #3803.
2017-07-13Add LaTeX xspace support (#3797)schrieveslaach1-0/+12
2017-07-13Merge branch 'master' of https://github.com/jgm/pandoc into textcolor-supportMarc Schreiber1-1103/+1671
2017-07-12Remove redundant imports (#3796)Alexander Krotov1-1/+1
2017-07-12Make sure \write18 is parsed as raw LaTeX.John MacFarlane1-7/+9
The change is in the LaTeX reader's treatment of raw commands, but it also affects the Markdown reader.
2017-07-07Use takeP in LaTeX reader.John MacFarlane1-4/+4
2017-07-07Rewrote LaTeX reader with proper tokenization.John MacFarlane1-1080/+1645
This rewrite is primarily motivated by the need to get macros working properly. A side benefit is that the reader is significantly faster (27s -> 19s in one benchmark, and there is a lot of room for further optimization). We now tokenize the input text, then parse the token stream. Macros modify the token stream, so they should now be effective in any context, including math. Thus, we no longer need the clunky macro processing capacities of texmath. A custom state LaTeXState is used instead of ParserState. This, plus the tokenization, will require some rewriting of the exported functions rawLaTeXInline, inlineCommand, rawLaTeXBlock. * Added Text.Pandoc.Readers.LaTeX.Types (new exported module). Exports Macro, Tok, TokType, Line, Column. [API change] * Text.Pandoc.Parsing: adjusted type of `insertIncludedFile` so it can be used with token parser. * Removed old texmath macro stuff from Parsing. Use Macro from Text.Pandoc.Readers.LaTeX.Types instead. * Removed texmath macro material from Markdown reader. * Changed types for Text.Pandoc.Readers.LaTeX's rawLaTeXInline and rawLaTeXBlock. (Both now return a String, and they are polymorphic in state.) * Added orgMacros field to OrgState. [API change] * Removed readerApplyMacros from ReaderOptions. Now we just check the `latex_macros` reader extension. * Allow `\newcommand\foo{blah}` without braces. Fixes #1390. Fixes #2118. Fixes #3236. Fixes #3779. Fixes #934. Fixes #982.
2017-06-20Move CR filtering from tabFilter to the readers.John MacFarlane1-1/+2
The readers previously assumed that CRs had been filtered from the input. Now we strip the CRs in the readers themselves, before parsing. (The point of this is just to simplify the parsers.) Shared now exports a new function `crFilter`. [API change] And `tabFilter` no longer filters CRs.
2017-06-12Merge branch 'master' into textcolor-supportschrieveslaach1-81/+135
2017-06-11Support for \faCheck and \faClose (#3727)schrieveslaach1-0/+3
2017-06-10Changed all readers to take Text instead of String.John MacFarlane1-2/+3
Readers: Renamed StringReader -> TextReader. Updated tests. API change.
2017-06-01LaTeX reader: handle some width specifiers on table columns.John MacFarlane1-3/+13
Currently we only handle the form `0.9\linewidth`. Anything else would have to be converted to a percentage, using some kind arbitrary assumptions about line widths. See #3709.
2017-06-01LaTeX reader: more table refactoring.John MacFarlane1-12/+13
2017-06-01LaTeX reader: Small refactoring of table parsing code.John MacFarlane1-16/+18
This makes room for doing something with widths.
2017-06-01LaTeX reader: Handle block structure inside table cells.John MacFarlane1-18/+18
minipage is no longer required. Closes #3709.
2017-06-01Add \colorbox supportMarc Schreiber1-10/+12
2017-05-29LaTeX reader: handle escaped & inside table cell.John MacFarlane1-3/+5
Closes #3708.