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

Individual subfile compilation in wrong directory #1967

Closed
jmussman opened this issue Feb 28, 2020 · 7 comments
Closed

Individual subfile compilation in wrong directory #1967

jmussman opened this issue Feb 28, 2020 · 7 comments
Labels
enhancement Issue suggests an enhancement question Issue represents a question

Comments

@jmussman
Copy link

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: Yes/No

Describe the bug [Required]

In 18.7.1 a subfile compilation takes place in the subfile folder if there is a sub-folder. In 18.7.2 the compilation is taking place in the root document folder, even if I select the subfile folder when latexmk is executed. The .latex-temp (my compilation output) is never created in the subfolder, and the subfile compilation appears in .latex-temp in the root folder. The compilation fails, because the compiler is looking for the root document in the folder above the root folder.

Compiling the root document works fine, all the subfiles compile in as expected.

To Reproduce

Steps to reproduce the behavior:

  1. Pull https://github.com/nextstepitt/standard-course-template and load in VSCode.
  2. Open Workbook/workbook.tex and compile with latexmk (works).
  3. Open Workbook/01_Rename_Me/section-0.tex and compile with latexmk (fails).
  4. Revert to to 18.7.1 and try step 2, succeeds.

Expected behavior

I expect the subfile compilation to take place in the folder the subfile is in. I don't expect it to take place in the root folder. This is especially bad if multiple folders use the same subfile names, as in this project, because they step on each other in the root file .latex-temp.

I can revert to 18.7.1 for the time being to continue to work, but it would be nice if you could fix this for 18.7.3 :)

If I am doing something wrong, my bad. But all my projects fail, I've pointed you to the template for my projects which demonstrates the problem. I really think that you're just launching in the wrong directory :)

Logs [Required]

Please paste the whole log messages here, not parts of ones. It is very important to identify problems.

LaTeX Workshop Output [Required]

To access the log, click the 'TeX' icon on the Activity Bar on the left side, select 'View Log Messages', then select 'View LaTeX Workshop extension log'.

Latexmk: This is Latexmk, John Collins, 17 March 2019, version: 4.63b.
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="./.latex-temp"  "/Shared/Projects/Course Projects/NS70000 Software Engineering/NS70500 Software Development Tools/NS00300 Course Template/Workbook/01_Rename-Me/section-0.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/Shared/Projects/Course Projects/NS70000 Software Engineering/NS70500 Software Development Tools/NS00300 Course Template/Workbook/01_Rename-Me/section-0.tex
LaTeX2e <2018-12-01>
(/usr/local/texlive/2019/texmf-dist/tex/latex/subfiles/subfiles.cls
Document Class: subfiles 2018/07/31 Federico Garcia, Gernot Salzer
Preamble taken from file `../workbook'

! LaTeX Error: File `../workbook.tex' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: tex)

Enter file name: 
/usr/local/texlive/2019/texmf-dist/tex/latex/subfiles/subfiles.cls:35: Emergency stop.
<read *> 
         
l.35 \input{\preamble@file}
                           ^^M
/usr/local/texlive/2019/texmf-dist/tex/latex/subfiles/subfiles.cls:35:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on ./.latex-temp/section-0.log.
Latexmk: Missing input file: '../workbook.tex' from line
  '! LaTeX Error: File `../workbook.tex' not found.'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets

Developer Tools Console [Required]

TMScopeRegistry.ts:45 Overwriting grammar scope name to file mapping for scope source.sql.
Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/sql/syntaxes/sql.tmLanguage.json.
New grammar file: file:///Users/jmussman/.vscode/extensions/mtxr.sqltools-0.21.6/language/sql.tmLanguage.json
register @ TMScopeRegistry.ts:45
2console.ts:137 [Extension Host] (node:36336) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ console.ts:137
mainThreadExtensionService.ts:65 [[object Object]]ENOENT: no such file or directory, open '/Shared/Projects/Course Projects/NS70000 Software Engineering/NS70500 Software Development Tools/NS00300 Course Template/Workbook/.latex-temp/.latex-temp/workbook.aux'
$onExtensionRuntimeError @ mainThreadExtensionService.ts:65
mainThreadExtensionService.ts:66 Error: ENOENT: no such file or directory, open '/Shared/Projects/Course Projects/NS70000 Software Engineering/NS70500 Software Development Tools/NS00300 Course Template/Workbook/.latex-temp/.latex-temp/workbook.aux'
	at Object.openSync (fs.js:447)
	at Object.func (electron/js2c/asar.js:138)
	at Object.func [as openSync] (electron/js2c/asar.js:138)
	at Object.readFileSync (fs.js:349)
	at Object.fs.readFileSync (electron/js2c/asar.js:580)
	at Object.fs.readFileSync (electron/js2c/asar.js:580)
	at /Users/jmussman/.vscode/extensions/james-yu.latex-workshop-8.7.2/out/src/components/manager.js:508
	at Array.forEach (<anonymous>)
	at Manager.parseFlsFile (/Users/jmussman/.vscode/extensions/james-yu.latex-workshop-8.7.2/out/src/components/manager.js:506)
	at Builder.buildFinished (/Users/jmussman/.vscode/extensions/james-yu.latex-workshop-8.7.2/out/src/components/builder.js:344)
	at ChildProcess.<anonymous> (/Users/jmussman/.vscode/extensions/james-yu.latex-workshop-8.7.2/out/src/components/builder.js:321)
	at ChildProcess.emit (events.js:200)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:272)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:66
notificationsAlerts.ts:40 Recipe terminated with error.
onDidNotificationChange @ notificationsAlerts.ts:40
log.ts:197   ERR No application in the Launch Services database matches the input criteria.: Error: No application in the Launch Services database matches the input criteria.

Screenshots

Note .latex-temp never made in 01_Rename_Me:

image

Desktop [Required]

  • OS: MacOS 10.14.6
  • VS Code version: 1.42.1
  • Extension version: 18.7.2
  • TeX distribution version: 3.14159265 (this is not the issue, 18.7.1 works fine).

Additional questions

Are you using LaTeX Workshop with VS Code Remote?

No

If the answer is Yes, please write which one you are using. Write the versions of the remote extension.

  • Remote Containers/Remote SSH/Remote WSL
  • Remote Extension Version: [e.g. 0.48.0]

Additional context

N/A

@jmussman
Copy link
Author

I meant to be typing 8.7.2 and 8.7.1, I think I'm a little tired from trying to debug this and I typed 18 in some places. My appologies.

@jlelong
Copy link
Collaborator

jlelong commented Feb 28, 2020

Short answer: you need to pass the -cd option to latexmk.

This was added by default in 8.7.1 but removed in 8.7.2 because of #1932 (basically a bug in latexmk). The solution described at the bottom of #1895 and in the wiki (item 4.) is to add a .latexmkrc file containing $do_cd = 1;.

Also for some strange reason, pdflatex/latexmk seem to be happier when the output directory is set to .latex-temp rather than ./.latex-temp.

@jmussman
Copy link
Author

Sorry Jerome, my bad then. I read through the faq, but I missed that, I think the sentence that preceded it tripped me up but it's my fault. I didn't find 1895, only 1890.

Just for the record: reading 1995 I can't say that I'm really happy with the argument/solution in 1895. It's asking the extension to fix something for the tool latexmk. But that won't work if you set up a project that doesn't always use the extension, like the one that I passed you has build scripts as well. It also suffices for latexmk, but not other tools. Most tools just assume they are working in the current directory, no?

I would argue that the correct solution would have been for the extension to let the tools run as they are and to adjust path, which I do in that template with a variable that is set at the correct level the build is happening at.

But, I'm not going to try to fight about it if -cd will fix it :) Thanks for your help, and much more for doing a bang-up job on the extension!

@jlelong
Copy link
Collaborator

jlelong commented Feb 28, 2020

Just for the record: reading 1995 I can't say that I'm really happy with the argument/solution in #1895. It's asking the extension to fix something for the tool latexmk.
I would argue that the correct solution would have been for the extension to let the tools run as they are and to adjust path, which I do in that template with a variable that is set at the correct level the build is happening at.

Could you comment on that? I have spent a lot of time working on different use cases and tried to come up with almost ready to work solution. Yet, I would be happy discuss other approaches. I must say that playing with subfiles, packages calling external commands and -output-directory soon creates a mess.

FYI, the -cd option is harmless if latexmk is launched from the current directory.

@jmussman
Copy link
Author

I would be happy too. Would you like my notes on this issue, or on #1895 where the discussion originally was?

@jlelong
Copy link
Collaborator

jlelong commented Feb 28, 2020

It may be easier to follow up on #1895.

@jmussman
Copy link
Author

Discussion of using a variable to change paths for different compilations entered into issue #1895 comments. Thanks @jlelong.

Repository owner locked as resolved and limited conversation to collaborators Jun 3, 2021
@tamuratak tamuratak added enhancement Issue suggests an enhancement question Issue represents a question labels Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Issue suggests an enhancement question Issue represents a question
Projects
None yet
Development

No branches or pull requests

3 participants