-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render a latex environment input as a paragraph #1401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not immediately clear to me what exact issue this fixes. Could you add a small test case to e.g. the latex_simple tests for this? tests_latex.jl
builds and tests the LaTeX tests, but you do have to instantiate the test environment.
src/Writers/LaTeXWriter.jl
Outdated
@@ -498,8 +498,15 @@ function _print_code_escapes_inline(io, s::AbstractString) | |||
end | |||
|
|||
function latex(io::IO, md::Markdown.Paragraph) | |||
for md in md.content | |||
latexinline(io, md) | |||
if occursin(r"^\h*?\\begin{\p{Xan}*?}", md.content[begin]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The [begin]
syntax was added in 1.4, so this would have to be rewritten as e.g. first(md.content)
to be compatible with 1.0.
Add test items for #1401.
@@ -499,8 +499,15 @@ function _print_code_escapes_inline(io, s::AbstractString) | |||
end | |||
|
|||
function latex(io::IO, md::Markdown.Paragraph) | |||
for md in md.content | |||
latexinline(io, md) | |||
if occursin(r"^\h*?\\begin{\p{Xan}*?}", first(md.content)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elements of md.content
are not guaranteed to be strings, so this implementation may throw an error: https://travis-ci.org/github/JuliaDocs/Documenter.jl/jobs/717872752#L320-L329
I took the liberty of updating the tests a bit, so the last inline comment is now attached to the wrong place. However, in the examples:
This is how the examples render with master (since this branch currently errors): DocumenterLaTeXSimple.pdf |
Sometimes, the output of a
@example
block is itself a latex environment, such as a DataFrame.In this case, some special characters, such as
&
and\
, are not need escaped, except for the linebreak symbol\\
.This pr intends to do this.
This is related to issue #1346.