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

Add the option to analyse inputs #45

Closed
thehubbard opened this issue Oct 22, 2018 · 3 comments
Closed

Add the option to analyse inputs #45

thehubbard opened this issue Oct 22, 2018 · 3 comments
Labels
closed in dev Issue is closed in dev branch
Milestone

Comments

@thehubbard
Copy link

Hello

It would be useful if the code also processed included sub files via the \input command

For example at the moment a master document such as

\documentclass[11pt]{article}
\begin{document}

\section{Introduction}
\input{Intro.tex}

\section{Conclusion}
\input{Conclusion.tex}

\end{document}

would only analyse section headers. The paragraphs etc which are contained in sub files Intro.tex and Conclusion.tex are ignored. At the moment textidote has to be run individually on each independent file which takes time. A feature enhancement would take sub files into account.

Many thanks

@sylvainhalle
Copy link
Owner

Hi! That's an interesting suggestion. However, it requires interpreting LaTeX markup, something that TeXtidote does not currently do. This is by design: once you start doing this, there is no end to it --TeXtidote will end up as a reimplementation of LaTeX if you wait long enough. (See my similar response to issue #31.)

I'd be reticent to add such a feature. Note however that you can run TeXtidote with multiple file names on the command line, and it will check each of these files in batch. You can even automate this by using a configuration file (see Readme). This is not exactly what you want, but close enough I think.

@hoehnp
Copy link

hoehnp commented Nov 11, 2018

Hi!
Thank you for your great tool. I would be also interested in this feature. Would you accept a PR implementing the functionality. As you suggest, one could maybe implement it by doing preprocessing with an external script which adds the tex files in a folder recursively. At the end oen could maybe have links in the mail file going to the input files. What are your ideas?

@sylvainhalle
Copy link
Owner

Hi! Finding all tex files recursively from a root folder can already be done with find; you can also pass that list of files to TeXtidote relatively easily:

textidote $(find . -name "*.tex")

But I agree that this finds all tex files, not only the ones that appear in a non-commented \input or \include instruction inside a main file.

Maybe following the inputs would not be such a big deal after all. One could add a --follow command line argument that would add filenames encountered in a list, and process all files from the list in sequence. I'll flag this as a new feature for the next release (0.7).

@sylvainhalle sylvainhalle added this to the v0.7 milestone Nov 13, 2018
sylvainhalle added a commit that referenced this issue Jan 2, 2019
Currently, the program can locate files present in an \input or \include instruction, add them to a queue of files to process, and avoid duplicated work by remembering files that have already been processed before (in case they are included multiple times).

Remaining work:
- Location of included files is relative to path of main file, so this path must be appended to each include or T will not find them.
- Should come up with a "test mode" for the main loop where files are loaded with getResourceAsStream instead of regular File objects to use with unit tests)
@sylvainhalle sylvainhalle added the closed in dev Issue is closed in dev branch label Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed in dev Issue is closed in dev branch
Projects
None yet
Development

No branches or pull requests

3 participants