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 \subfile in addition to \include #115

Closed
shankari opened this issue Dec 18, 2019 · 5 comments
Closed

Support \subfile in addition to \include #115

shankari opened this issue Dec 18, 2019 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@shankari
Copy link

First, thank you for writing this very cool tool. It is super helpful to me as I proofread my thesis. However, I noticed one inconsistency while running the command.

The documentation says:

TeXtidote also automatically follows sub-files that are embedded from a main document using \input{filename} and \include{filename} (braces are mandatory). Any such non-commented instruction will add the corresponding filename to the running queue.

My thesis uses \subfile for individual chapter sections. This is mainly because the template I use has \subfile instead of \include.

It looks like \subfiles are not added to the queue by default. If I change \subfile to \include, I get many more corrections.

If it makes sense to add \subfile as well, I can take a stab at poking through the source code and seeing if I can make the (hopefully minor) change required to support it as well.

@shankari
Copy link
Author

I assume the fix is to expand the pattern here

protected static final transient Pattern m_includePattern = Pattern.compile("^.*\\\\(input|include)\\s*\\{(.*?)\\}.*$");

@sylvainhalle
Copy link
Owner

Thank you for your proposed contribution. You are right: this is the line where subfile should be added next to input and include. I'll mark this as an enhancement for the next release.

@sylvainhalle sylvainhalle added the enhancement New feature or request label Dec 18, 2019
@sylvainhalle sylvainhalle added this to the v0.9 milestone Dec 18, 2019
@sylvainhalle sylvainhalle changed the title (enhancement) support \subfile in addition to \include? Support \subfile in addition to \include Dec 18, 2019
@shankari
Copy link
Author

ok so this fix is not going to be a one-liner. It turns out that \subfile requires the full path of the included file, not the relative path like \include does.

@shankari
Copy link
Author

shankari commented Dec 18, 2019

The options to fix this is strip out the prefix (e.g. convert chapters/chap1/chap1-section1.tex to chap1/chap1-section1.tex in fetchIncludes.

  • However, we don't actually know the prefix in LatexCleaner since it is created directly with AnnotatedString.
  • and in the place where we do know the filename (Main), we don't know whether the file was added using \include or \subfile and needs to be stripped or not

@sylvainhalle any thoughts on the best structure for the changes? Or is this too complicated and you want to leave \subfile unsupported?

@sylvainhalle
Copy link
Owner

May I suggest we move this discussion to #131

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

No branches or pull requests

2 participants