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

Error with inputs and includes #81

Closed
PierreMarchand20 opened this issue Apr 12, 2019 · 24 comments
Closed

Error with inputs and includes #81

PierreMarchand20 opened this issue Apr 12, 2019 · 24 comments
Labels
bug Something isn't working
Milestone

Comments

@PierreMarchand20
Copy link
Contributor

PierreMarchand20 commented Apr 12, 2019

I noticed that textidote does not find subfiles with \input if the name of the file does not contain .tex. But it should since LaTex works either way.

Even worse, using \include with .tex at the end of the filename does not work in LaTeX but it seems necessary for textidote to find the subfiles

@sylvainhalle sylvainhalle added the bug Something isn't working label Apr 12, 2019
@sylvainhalle sylvainhalle added this to the v0.8 milestone Apr 12, 2019
@ngartner
Copy link

Hello, in addition it seems TeXtidote can't find items in subfolders. For exemple if the Path given is .\Part1\Part1.tex it returns "not found".

@sylvainhalle
Copy link
Owner

The last comment is related to #64

sylvainhalle added a commit that referenced this issue Aug 5, 2019
@PierreMarchand20
Copy link
Contributor Author

I still have an issue:

thesis.tex
corps/bem_chap.tex
corps/bem/sobolev_spaces.tex

with \include{corps/bem_chap} in thesis.tex and \input{corps/bem/sobolev_spaces} in corps/bem_chap.tex
and I get (for example)

File corps/corps/bem/sobolev_spaces.tex not found (skipping)

@PierreMarchand20
Copy link
Contributor Author

Notice that I also have the issue with I use \input with the file extension.

@sylvainhalle
Copy link
Owner

Ah, I think I see. Is the input path relative to the root file, or relative to the file that contains the command? TeXtidote interprets it as the latter.

@sylvainhalle sylvainhalle reopened this Aug 6, 2019
@PierreMarchand20
Copy link
Contributor Author

It is relative to the root file, it does not work otherwise.

@sylvainhalle
Copy link
Owner

OK, so this is why it doesn't work. I'll fix this shortly.

sylvainhalle added a commit that referenced this issue Aug 6, 2019
@sylvainhalle
Copy link
Owner

I've just pushed a fix. Could someone please check that it has the intended behavior (I checked on my side and it seems to be OK). Then I'll re-re-close the issue.

@PierreMarchand20
Copy link
Contributor Author

How can I try it ? I am on macOS so I need the .jar file I think

@sylvainhalle
Copy link
Owner

Here is a Dropbox link to a compiled JAR: https://www.dropbox.com/s/amgcn61dwvzpnk2/textidote.jar?dl=0

@PierreMarchand20
Copy link
Contributor Author

It works fine on my phd thesis 👍

@PierreMarchand20
Copy link
Contributor Author

PierreMarchand20 commented Aug 6, 2019

Actually there is something. The last update fixed the case where someone call textidote on the main file. The issue is that the file may be too big to read so that he wants to call textidote on a subfile using the option --read-all. In this case it does not work.

Taking my example, one cannot call textidote directly on corps/bem_chap.tex.

> java -jar ~/Downloads/textidote-2.jar  --output html --read-all corps/bem_chap.tex > report.html
TeXtidote v0.8.1 - A linter for LaTeX documents and others
(C) 2018-2019 Sylvain Hallé - All rights reserved

File corps/corps/bem/sobolev_spaces.tex not found (skipping)

@PierreMarchand20
Copy link
Contributor Author

PierreMarchand20 commented Aug 6, 2019

One thing that could help is that in multi-file project, usually we use magic comment such as % !TEX root = ../thesis.tex to refer to the main file of the project.

So that you could use it to fix the path given in \input.

@PierreMarchand20
Copy link
Contributor Author

PierreMarchand20 commented Aug 14, 2019

@domoritz
Copy link

I just wanted to note that the 0.8 release fixed issues I experienced with includes before. Thank you @sylvainhalle!

@hassec
Copy link

hassec commented Aug 19, 2019

I've actually noticed some weird behavior as far as includes go.

My folder structure is a main.tex file with multiple input{content/xyz.tex} statements.
When running a check, a get a nice HTML report that lists all of these files.
However, running textidote --clean to check the cleaned version I only see the output of the main file...

Am I missing something, or is the clean option not including these files correctly?

Edit: this is run with v0.8.1

@sylvainhalle
Copy link
Owner

@hassec: this is a bug; the --clean option should work recursively on included files.

@sylvainhalle
Copy link
Owner

@PierreMarchand20: I'd prefer a command line switch you could pass to TeXtidote. I am a bit afraid if I need to start supporting the features of another software. And as I can see, there are lots of other magic commands, so once you start supporting one, somebody else will ask for another...

@PierreMarchand20
Copy link
Contributor Author

My point was that actually it is not specific to a software. It is a convention widely used in my opinion, it worked like that in all the “softwares”/plugins of editor I used so far (texstudio, texshop, Plugins for atom and now VSCode). Actually in the second answer of https://tex.stackexchange.com/questions/78101/when-and-why-should-i-use-tex-ts-program-and-tex-encoding you can see that all the presented softwares support magic comment for root.

Besides, magic comments give information to the compiler, so that the other magic comments should not be relevant for TeXidote. (See first answer of https://tex.stackexchange.com/questions/78101/when-and-why-should-i-use-tex-ts-program-and-tex-encoding for most of the magic comments)

That being said, a command line like -root rootfile should also work well.

@samuelstjean
Copy link

I'm wondering, does it also work when using subfiles? Seems like it picks up all of my include/input, but not my files included from the subfile package, which allows to specify a sub document with it's begin/end clauses and everything, kind of like this

\chapter{Introduction}
\label{chap:introduction}
 
\begin{filecontents}{bibfiles/intro.bib}
@online{wiki_neuron,
author = "BruceBlaus",
title = "Neuron",
year = "2019",
% urlseen = "03-02-13",
url = "https://commons.wikimedia.org/wiki/File:Blausen_0657_MultipolarNeuron.png",
keywords = {wiki},
note = "https://creativecommons.org/licenses/by-sa/3.0/legalcode",
}
\end{filecontents}
 
 
\begin{refsection}
\subfile{chapters/intro/intro.tex}
\pageclear
\printbibliography
\end{refsection}
 
\begin{refsection}[bibfiles/intro.bib]
\nocite{*}
\printbibliography[title={Additional attributions},heading=subbibliography]
\pageclear
\end{refsection}

Here my file intro.tex is pretty much a standalone document, so it may just be a case of allowing these files in addition to the input/include command. Perfect when you are lazy and just adding in entirely the content of an old document you did previously.

@sylvainhalle
Copy link
Owner

Currently it only works for \input and \include. Do you think it would just be a matter of adding the \subfile to the detection? In other words, do these files need different handling from \input and \include?

@samuelstjean
Copy link

It depends if you also look explicitly for \begin and \end document. A subfile will always be of class subfiles and refers to the file calling it, just like this

\documentclass[../intro.tex]{subfiles}
\begin{document}

stuff here

\end{document}

The main use is to have very large documents which are self contained, like chapters in a thesis that are built using your old manuscripts. In my previous snippet, the subfile part refers to this file here, that is

\subfile{chapters/intro/intro.tex} is part of my main document using include and intro.tex (in a barebone version) is what I posted here. If it's not super clear, the package documention is about 5 pages long https://ctan.org/pkg/subfiles

@sylvainhalle
Copy link
Owner

OK, will mark it as enhancement, but I'll have to look at the doc in detail to make sure it is not a case of #56.

This was referenced Jun 17, 2020
@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
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants