Skip to content

TeX file is not moved to output-dir #1294

Open

Description

@connorp

Bug description

When exporting to PDF, and keep-tex: true and output-dir: "outdir" are both set in the relevant YAML, the .tex file remains in the working directory, even after the .pdf file is moved to outdir.

Reprex

  1. Create a new Quarto project, with the following contents in the _quarto.yml file:
    project:
      title: "test"
      output-dir: "outdir"
    
  2. Create a test.qmd file with the following contents:
    ---
    title: "test"
    format:
      pdf:
        keep-tex: true
    ---
    
    Hello
    
  3. Render the project. Observe that test.pdf is in the outdir subdirectory, but test.tex remains in the project directory.

System Stats

Results of quarto check:

[✓] Checking Quarto installation......OK
      Version: 0.9.637
      Path: /Applications/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.9.6 (Conda)
      Path: /Users/connor/opt/miniforge/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........OK
      Version: 4.2.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK

RStudio Version 2022.02.3 Build 492. Session Info:

R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1   

Checklist

  • formatted your issue so it is easier for us to read?
  • included a minimal, self-contained, and reproducible example?
  • documented the quarto version you're running, by providing the output produced by quarto check in a terminal in your issue?
  • documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • documented which operating system you're running? If on Linux, please provide the specific distribution as well.
  • upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?

Activity

  1. added
    bug
    on Jul 6, 2022
  2. jjallaire commented on Jul 6, 2022

    @jjallaire
    Collaborator

    The purpose of keep-tex is that you can run e.g. mklatex on it and produce the PDF. If we move it to the output-dir then this no longer works. So this behavior is by design.

  3. connorp commented on Jul 6, 2022

    @connorp
    Author

    Hmm, interesting. I think this behavior does actually cause problems in a reasonable use case. If I have my .qmd file in a subdirectory of the project directory called code, and I set output-dir: outputs, Quarto will move the .pdf file and all the assets/images files into outputs, but leave the .tex in code. That movement happens after Quarto/pandoc invokes TeX to render the PDF, so it works fine then. But if I then were to try to render that .tex file again with TeX myself, it would fail, because the links to the assets/images are now broken.

  4. jjallaire commented on Jul 6, 2022

    @jjallaire
    Collaborator

    The movement of assets/images into output-dir works only by accident (b/c the _files dir also has the HTML assets and is copied). Images are also copied only if they are also referenced in HTML. So you are free riding on the HTML behavior for LaTeX. The real fix is to make tex a proper output format for books and actually copy all of the assets (even if there is no HTML in play).

    Net is that I agree this doesn't quite do what you want it to but its not a simple "copy here instead of there" fix, we need to do a bit more legwork to make it all work properly.

  5. connorp commented on Jul 6, 2022

    @connorp
    Author

    Okay, makes sense. Is this issue sufficient to flag this as an area for future improvement, or should I reframe and resubmit? FWIW, I don't think this is an issue just for books. I'm rendering a very simple .qmd to TeX/PDF that just has a line of R code that makes a graph. It's that graph image that is then separated from its associated .tex file. But for now, I'll just refrain from using output-dir in this use case.

  6. jjallaire commented on Jul 6, 2022

    @jjallaire
    Collaborator

    We know we need to take care of this both for .tex as well as for other text based formats like asciidoc. Yes, we would indeed need to make it work for any use of output-dir. So no need for an issue (I'll reopen this one as a form of reminder but it's for sure on the list already)

  7. added this to the Future milestone on Jul 7, 2022
  8. added
    files
    on Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfiles

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions