Skip to main content
added 403 characters in body
Source Link
Steven
  • 445
  • 2
  • 12

EDIT 2

I also see that the LaTeX Workshop extension has a configuration option for automatic root file detection. This automatic detection is not working in my favour here. How can I disable this? Neither of the two existing options are what I want.

configuration options

EDIT 2

I also see that the LaTeX Workshop extension has a configuration option for automatic root file detection. This automatic detection is not working in my favour here. How can I disable this? Neither of the two existing options are what I want.

configuration options

added 403 characters in body
Source Link
Steven
  • 445
  • 2
  • 12

Setup

I have the following folder structure:

home/ A/ A.tex C.tex B/ B.tex C.tex 

and the file contents are as follows

home/A/A.tex

\input{../B/B.tex} 

home/B/B.tex

\documentclass{article} \begin{document} Hello from B! \input{C.tex} \end{document} 

home/A/C.tex

Hello from A/C! 

home/B/C.tex

Hello from B/C! 

Result

As mentioned in the title, I'm using the LaTeX Workshop in VSCode. When I run A/A.tex, I expect it to create A/A.pdf which displays

Hello from B! Hello from A/C! 

However, it does not do that! Instead, it creates B/B.pdf which displays

Hello from B! Hello from B/C! 

which is not what I expect and not what I need. It seems as if VSCode automatically changes the input path to that of B/B.tex.

Some research

I noticed this doesn't happen in Texmaker. Also, if I temporarily change the content of A/A.tex to what's displayed below, then the input path resolves itself and I obtain A/A.pdf.

% \input{../B/B.tex} \documentclass{article} \begin{document} Hello from A! \end{document} 

I then undo these changes, then compile A/A.tex again and then I do obtain the A/A.pdf with the expected content!

What's more, the editor tab in VSCode displays the input path (I think?) and it's updated as mentioned above:

Before:
Before

After:
After

To me, it is a lot of indication that it's VSCode, or LaTeX Workshop, and not LaTeX that does a lot of automatic resolving of input paths, which I do not want/need.

Question

Why does it do this and how can I resolve it? How can I ensure that VSCode always creates the PDF corresponding to the TeX file that I'm compiling?

Edits to this post

EDIT 1

Before I update A/A.tex with a document class and undo this, the output file says

Running 'pdflatex --max-print-line=10000 -synctex=1 -interaction=nonstopmode -file-line-error -recorder "c:/Users/.../B/B.tex"' 

The file being asked to compiled is indeed plain wrong. This fits perfectly with what I'm seeing. How can this be corrected in VSCode?

Setup

I have the following folder structure:

home/ A/ A.tex C.tex B/ B.tex C.tex 

and the file contents are as follows

home/A/A.tex

\input{../B/B.tex} 

home/B/B.tex

\documentclass{article} \begin{document} Hello from B! \input{C.tex} \end{document} 

home/A/C.tex

Hello from A/C! 

home/B/C.tex

Hello from B/C! 

Result

As mentioned in the title, I'm using the LaTeX Workshop in VSCode. When I run A/A.tex, I expect it to create A/A.pdf which displays

Hello from B! Hello from A/C! 

However, it does not do that! Instead, it creates B/B.pdf which displays

Hello from B! Hello from B/C! 

which is not what I expect and not what I need. It seems as if VSCode automatically changes the input path to that of B/B.tex.

Some research

I noticed this doesn't happen in Texmaker. Also, if I temporarily change the content of A/A.tex to what's displayed below, then the input path resolves itself and I obtain A/A.pdf.

% \input{../B/B.tex} \documentclass{article} \begin{document} Hello from A! \end{document} 

I then undo these changes, then compile A/A.tex again and then I do obtain the A/A.pdf with the expected content!

What's more, the editor tab in VSCode displays the input path (I think?) and it's updated as mentioned above:

Before:
Before

After:
After

To me, it is a lot of indication that it's VSCode, or LaTeX Workshop, and not LaTeX that does a lot of automatic resolving of input paths, which I do not want/need.

Question

Why does it do this and how can I resolve it? How can I ensure that VSCode always creates the PDF corresponding to the TeX file that I'm compiling?

Setup

I have the following folder structure:

home/ A/ A.tex C.tex B/ B.tex C.tex 

and the file contents are as follows

home/A/A.tex

\input{../B/B.tex} 

home/B/B.tex

\documentclass{article} \begin{document} Hello from B! \input{C.tex} \end{document} 

home/A/C.tex

Hello from A/C! 

home/B/C.tex

Hello from B/C! 

Result

As mentioned in the title, I'm using the LaTeX Workshop in VSCode. When I run A/A.tex, I expect it to create A/A.pdf which displays

Hello from B! Hello from A/C! 

However, it does not do that! Instead, it creates B/B.pdf which displays

Hello from B! Hello from B/C! 

which is not what I expect and not what I need. It seems as if VSCode automatically changes the input path to that of B/B.tex.

Some research

I noticed this doesn't happen in Texmaker. Also, if I temporarily change the content of A/A.tex to what's displayed below, then the input path resolves itself and I obtain A/A.pdf.

% \input{../B/B.tex} \documentclass{article} \begin{document} Hello from A! \end{document} 

I then undo these changes, then compile A/A.tex again and then I do obtain the A/A.pdf with the expected content!

What's more, the editor tab in VSCode displays the input path (I think?) and it's updated as mentioned above:

Before:
Before

After:
After

To me, it is a lot of indication that it's VSCode, or LaTeX Workshop, and not LaTeX that does a lot of automatic resolving of input paths, which I do not want/need.

Question

Why does it do this and how can I resolve it? How can I ensure that VSCode always creates the PDF corresponding to the TeX file that I'm compiling?

Edits to this post

EDIT 1

Before I update A/A.tex with a document class and undo this, the output file says

Running 'pdflatex --max-print-line=10000 -synctex=1 -interaction=nonstopmode -file-line-error -recorder "c:/Users/.../B/B.tex"' 

The file being asked to compiled is indeed plain wrong. This fits perfectly with what I'm seeing. How can this be corrected in VSCode?

Source Link
Steven
  • 445
  • 2
  • 12

How to fix relative input path referencing using LaTeX Workshop in VSCode?

Setup

I have the following folder structure:

home/ A/ A.tex C.tex B/ B.tex C.tex 

and the file contents are as follows

home/A/A.tex

\input{../B/B.tex} 

home/B/B.tex

\documentclass{article} \begin{document} Hello from B! \input{C.tex} \end{document} 

home/A/C.tex

Hello from A/C! 

home/B/C.tex

Hello from B/C! 

Result

As mentioned in the title, I'm using the LaTeX Workshop in VSCode. When I run A/A.tex, I expect it to create A/A.pdf which displays

Hello from B! Hello from A/C! 

However, it does not do that! Instead, it creates B/B.pdf which displays

Hello from B! Hello from B/C! 

which is not what I expect and not what I need. It seems as if VSCode automatically changes the input path to that of B/B.tex.

Some research

I noticed this doesn't happen in Texmaker. Also, if I temporarily change the content of A/A.tex to what's displayed below, then the input path resolves itself and I obtain A/A.pdf.

% \input{../B/B.tex} \documentclass{article} \begin{document} Hello from A! \end{document} 

I then undo these changes, then compile A/A.tex again and then I do obtain the A/A.pdf with the expected content!

What's more, the editor tab in VSCode displays the input path (I think?) and it's updated as mentioned above:

Before:
Before

After:
After

To me, it is a lot of indication that it's VSCode, or LaTeX Workshop, and not LaTeX that does a lot of automatic resolving of input paths, which I do not want/need.

Question

Why does it do this and how can I resolve it? How can I ensure that VSCode always creates the PDF corresponding to the TeX file that I'm compiling?