Commit graph

12 commits

Author SHA1 Message Date
John MacFarlane
b263f38304 LaTeX reader: improve mathEnvWith.
When converting e.g. an align environment to an aligned environment
inside a Math element, we need to include a newline before the
`\end{aligned}`, since the previous line might end in a comment.

Closes #8122.
2022-06-13 23:14:51 -06:00
John MacFarlane
a0e44b1ff6 LaTeX reader: improve handling of plain TeX macro primitives.
- Fixed semantics for `\let`.
- Implement `\edef`, `\gdef`, and `\xdef`.
- Add comment noting that currently `\def` and `\edef` set global
  macros (so are equivalent to `\gdef` and `\xdef`).  This should be
  fixed by scoping macro definitions to groups, in a future commit.

Closes #7474.
2021-08-11 10:32:52 -07:00
John MacFarlane
28cad16517 Markdown writer: prefer using raw_attribute when enabled.
The `raw_attribute` will be used to mark raw bits, even HTML
and LaTeX, and even when `raw_html` and `raw_tex` are enabled,
as they are by default.

To get the old behavior, disable `raw_attribute` in the writer.

Closes #4311.
2019-07-18 22:31:03 -07:00
John MacFarlane
22f81f78bd Added failing test case for macros. 2018-10-15 00:37:17 -07:00
John MacFarlane
88faa45f1d Markdown writer: ensure blank between raw block and normal content.
Otherwise a raw block can prevent a paragraph from being
recognized as such.

Closes #4629.
2018-10-14 17:12:06 -07:00
John MacFarlane
42f4632e60 LaTeX reader: Support more text-mode accents.
Add support for `\|`, `\b`, `\G`, `\h`, `\d`, `\f`,
`\r`, `\t`, `\U`, `\i`, `\j`, `\newtie`, `\textcircled`.

Also fall back to combining characters when composed
characters are not available.

Closes #4652.
2018-08-17 23:19:38 -07:00
John MacFarlane
e7d95cadf5 LaTeX reader: pass through macro defs in rawLaTeXBlock...
even if the `latex_macros` extension is set.
This reverts to earlier behavior and is probably safer
on the whole, since some macros only modify things in
included packages, which pandoc's macro expansion can't
modify.

Closes #4246.
2018-01-13 22:12:32 -08:00
John MacFarlane
28b736bf95 latex_macros extension changes.
Don't pass through macro definitions themselves when `latex_macros`
is set.  The macros have already been applied.

If `latex_macros` is enabled, then `rawLaTeXBlock` in
Text.Pandoc.Readers.LaTeX will succeed in parsing a macro definition,
and will update pandoc's internal macro map accordingly, but the
empty string will be returned.

Together with earlier changes, this closes #4179.
2017-12-22 18:03:51 -08:00
John MacFarlane
c806ef1b15 LaTeX reader: Support simple \def macros.
Note that we still don't support macros with fancy parameter
delimiters, like

    \def\foo#1..#2{...}
2017-08-07 16:06:19 -07:00
John MacFarlane
9e6b9cdc5f LaTeX reader: Support \let.
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-07 13:38:15 -07:00
John MacFarlane
439ffc2e7f Added a test case with markdown-latex_macros. 2017-07-24 00:02:55 +02:00
John MacFarlane
be14e2b501 LaTeX reader: some improvements in macro parsing.
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-24 00:02:55 +02:00