8000 LaTeX reader: ignore \noindent and flush(left|right) environments. by bucklereed · Pull Request #3956 · jgm/pandoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

LaTeX reader: ignore \noindent and flush(left|right) environments. #3956

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bucklereed
Copy link
Contributor

No description provided.

@jgm
Copy link
Owner
jgm commented Oct 7, 2017

I don't understand why we'd want to omit \noindent (even as a raw latex inline) even when raw_tex is enabled. I've certainly had occasions where I wanted to put a \noindent in there and pass it through...

@bucklereed
Copy link
Contributor Author

Okay, fair enough. I'm trying to cut down on the 'skipped content' warning noise, since they can indicate possibly-important things getting lost; I'd figured that \noindent was presentational and so droppable.

How about dropping \noindent if raw_tex is off, and preserving it as a raw inline if it's on? The only issue with that is that I will need to figure out how to test the absence of warnings.

@jgm
Copy l 8000 ink
Owner
jgm commented Oct 8, 2017 via email

@jgm
Copy link
Owner
jgm commented Oct 8, 2017

Though, to be sure, we do ignore some things without warning, like \strut.

Another thing to consider is whether these warnings for skipped content should be INFO rather than WARNING level. That would reduce noise.

@bucklereed
Copy link
Contributor Author

No, I think that when raw_tex is off it's particularly important to warn about skipped content, since in many cases people may be expecting something not to be skipped.

I was thinking of having a whitelist of presentational-ish things that are OK to skip if raw_tex is disabled, and warning if it's not on the whitelist. \noindent would be there, plus probably some sundry other things that are already being ignored on an ad-hoc basis. It would have all the problems of whitelists, but I think that, after a few iterations, it'd be a good 90% solution.

I am not sure about knocking the warning level down. The warnings are good; there are just a lot of them, and I suspect that a lot of that lot will be presentational stuff that can be dropped if the aim isn't to round-trip back to the input format.

So, what I'd like is for pandoc to ignore stuff that it knows won't survive a trip through the AST without using raw blobs.

Here's another straw proposal: pandoc -f latex will warn on \noindent (and anything else on the whitelist, plus everything that it doesn't explicitly know about). pandoc -f latex-raw_tex squelches warnings for the whitelist but not for entirely unknown things. pandoc -f latex+raw_tex will keep everything. Or maybe a separate extension makes more sense at this point--something like keep_raw_presentational, on by default for the latex reader?

@mb21
Copy link
Collaborator
mb21 commented Oct 23, 2017

I was thinking of having a whitelist of presentational-ish things that are OK to skip

I think that's a great idea. It's hard to debug conversion of a huge document if it's full of "skipped \noindent" warnings. Maybe we could just reduce the logger level for the things in the whitelist from WARNING to INFO as proposed by jgm? Regardless of the raw_tex switch as that would further complicate things (both for the user and for us).

@jgm
Copy link
Owner
jgm commented Oct 23, 2017 via email

@mb21
Copy link
Collaborator
mb21 commented Oct 23, 2017

One idea would be to reduce the log level for all skipped
content to INFO.

Not sure about that... in the discussed use-case, if pandoc skips something it doesn't understand, I'd like to know about it (because e.g. in the case of \lettrine, I needed to either fix pandoc or the latex source to get the part of that text). On the other hand, if pandoc is just skipping known presentational command (like \noindent), then I would like that to be somehow separable from the former (e.g. the former WARNING, the latter INFO).

I haven't looked at Logging.hs yet, but in the Writer, wouldn't we just want to call something like SkippedContentLevel INFO raw pos with SkippedContentLevel :: Verbosity -> String -> SourcePos?

@jgm
Copy link
Owner
jgm commented Oct 23, 2017 via email

@jgm
Copy link
Owner
jgm commented Mar 18, 2018

I think this PR should be closed, and we should perhaps open an issue suggesting changing the log level of the "skipped content" messages to INFO. Though that is something that certainly needs more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0