Skip to content
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

support for \endinput #77

Closed
andram opened this issue Jan 8, 2017 · 7 comments
Closed

support for \endinput #77

andram opened this issue Jan 8, 2017 · 7 comments

Comments

@andram
Copy link

andram commented Jan 8, 2017

Hi, I have a wishlist item:

at the moment, latexdiff is not aware of the \endinput command when files are included through \input or \include. It would be nice, if it could replicate what latex does: if \endinput is encountered in a file, treat it as if this is the end of the file itself and discard the rest of this file (including the \endinput command itself).

I am not sure how difficult this is to implement, but it would be very useful, as people tend to place \endinput in chapters of books, etc, to separate out work in progress sections, for example.

@ftilmann
Copy link
Owner

ftilmann commented Jan 8, 2017

I guess this is really about the behaviour of latexdiff with --flatten option.
Technically it should not be too difficult, but apparently the \endinput is sometimes wrapped by a conditional, and this would be difficult to replicate. So would you wish for \endinput to always be followed (which might break intended behaviour). Or would an acceptable compromise be to stop input only when \endinput begins right at the beginning of the line, and ignore it otherwise.

@andram
Copy link
Author

andram commented Jan 8, 2017

okay, I did not see this complication ... Yes, only processing \endinput on the beginning of a line would cover my usecases.

@ftilmann
Copy link
Owner

Should be fixed by commit 7e7d087

@andram
Copy link
Author

andram commented Jan 11, 2017

Thanks, I confirm that this works with current git.

One small thing is left in this context: If I write something like

%\include{chapter3}

then latex-diff still reads in the file "chapter3.tex", i.e. it seems to ignore the comment character "%" at the beginning of the line. The right thing would be to simply leave the line as a comment.

@ftilmann
Copy link
Owner

ftilmann commented Jan 11, 2017

latexdiff is supposed to do just that, and I cannot reproduce your reported bug. Can you send minimum working example? Are you using the current or github version of latexdiff?

@andram
Copy link
Author

andram commented Jan 12, 2017

yes, I just cloned the github version

MWE:

(v1.tex and v2.tex are identical, and chap1.tex does not exist)

>cat v1.tex
\documentclass{article}

\begin{document}
% \include{chap1}
\end{document}

>cat v2.tex
\documentclass{article}

\begin{document}
% \include{chap1}
\end{document}

>./dist/latexdiff-fast --flatten v1.tex v2.tex 
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\input{ <-- HERE (.*?)}|\\include{(.*?(?:\.tex)?)}/ at ./dist/latexdiff-fast line 1680.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/(^(?:[^%\n]|\\%)*)\\input{(.*?)}|\\include{ <-- HERE (.*?(?:\.tex)?)}/ at ./dist/latexdiff-fast line 1680.
Couldn't open ./chap1.tex: No such file or directory at ./dist/latexdiff-fast line 1520.

I can get rid of the two warnings by adding backslashes. The problem is the Couldn't open ./chap1.tex: No such file or directory at ./dist/latexdiff-fast line 1520.. latexdiff tries to access the file, although the \include{} command is commented out.

ftilmann added a commit that referenced this issue Jan 12, 2017
@ftilmann
Copy link
Owner

That was indeed a bug (now fixed). Other people must have been affected by it; thanks for reporting

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

No branches or pull requests

2 participants