aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/LaTeX.hs
AgeCommit message (Collapse)AuthorFilesLines
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.
2017-05-29LaTeX reader: don't crash on empty enumerate environment.John MacFarlane1-1/+1
Closes #3707.
2017-05-24LaTeX reader: Fixed failures on \ref{}, \label{} with `+raw_tex`.John MacFarlane1-6/+9
Now these commands are parsed as raw if `+raw_tex`; otherwise, their argument is parsed as a bracketed string.
2017-05-24Parsing: Provide parseFromString'.John MacFarlane1-6/+6
This is a verison of parseFromString specialied to ParserState, which resets stateLastStrPos at the end. This is almost always what we want. This fixes a bug where `_hi_` wasn't treated as emphasis in the following, because pandoc got confused about the position of the last word: - [o] _hi_ Closes #3690.
2017-05-24LaTeX reader: parse tikzpicture as raw verbatim environment...John MacFarlane1-0/+14
if `raw_tex` extension is selected. Otherwise skip with a warning. This is better than trying to parse it as text! Closes #3692.
2017-05-23Add suggestions of @jgm: parse bracketed stuff as inlinesMarc Schreiber1-3/+9
2017-05-21Finished implemtation of `--resource-path`.John MacFarlane1-2/+2
* Default is just working directory. * Working directory must be explicitly specifide if `--resource-path` option is used.
2017-05-16Merge pull request #3671 from WUUUGI/horizont-spacingJohn MacFarlane1-1/+1
Added support for horizontal spacing in LaTeX
2017-05-15Added support for horizontal spacing in LaTeX: parse \, to \8198 (six-per-em ↵Henri Werth1-1/+1
space)
2017-05-13Update dates in copyright noticesAlbert Krewinkel1-2/+2
This follows the suggestions given by the FSF for GPL licensed software. <https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html>
2017-05-06LaTeX reader: Better handling of comments inside math environments.John MacFarlane1-30/+43
This solves a problem with commented out `\end{eqnarray}` inside an eqnarray (among other things). Closes #3113.
2017-05-06Fix keyval funtion: pandoc did not parse options in braces correctly.… (#3642)schrieveslaach1-1/+1
* Fix keyval funtion: pandoc did not parse options in braces correctly. Additionally, dot, dash, and colon were no valid characters * Add | as possible option value * Improved code
2017-05-04\textcolor will be parse as span at the beginning of a paragraphMarc Schreiber1-1/+1
2017-05-03\textcolor works as inline and block commandMarc Schreiber1-1/+1
2017-05-03Add block version of \textcolorMarc Schreiber1-7/+15
2017-05-03LaTeX reader: Add support for tabularx environment (#3632)schrieveslaach1-1/+6
2017-05-02Add basic \textcolor support to LaTeX readerMarc Schreiber1-0/+8
2017-04-26LaTeX reader: Add basic support for hyphenat package (#3603)schrieveslaach1-1/+13
2017-04-26LaTeX reader: Add support for \vdots (#3607)schrieveslaach1-0/+1
2017-04-24LaTeX reader: better support for subfigure package.John MacFarlane1-5/+11
A figure with two subfigures turns into two pandoc figures; the subcaptions are used and the main caption ignored, unless there are no subcaptions. Closes #3577.
2017-04-22Add siunitx Support (#3588)schrieveslaach1-0/+17
For example: ```latex \SI[round-precision=2]{1}{m} is equal to \SI{1000}{mm}. \SI[round-precision=2]{1}[\$]{} is equal to \SI{0.938094}{\euro} ```
2017-03-29lstinline with braces can be used (verb cannot be used with braces) (#3535)schrieveslaach1-1/+8
* Fix lstinline handling: lstinline with braces can be used (verb cannot be used with braces) * Use codeWith and determine the language from lstinline * Improve code * Add another test: convert lstinline without language option
2017-03-27LaTeX reader: add support for LaTeX subfiles package.schrieveslaach1-0/+1
Closes #3530.