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

Working with nested standalone files #2234

Closed
cuppajoeman opened this issue Nov 8, 2021 · 2 comments
Closed

Working with nested standalone files #2234

cuppajoeman opened this issue Nov 8, 2021 · 2 comments
Labels

Comments

@cuppajoeman
Copy link

cuppajoeman commented Nov 8, 2021

Description

Trying to compile nested standalone files breaks because of path name.

Steps to reproduce

.
├── main.tex
└── sub
    ├── sub2
    │   └── sub2.tex
    └── sub.tex

main.tex

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{standalone}

\begin{document}

\input{sub/sub}

\end{document}

sub.tex

\documentclass{standalone}
\usepackage{standalone}
\begin{document}
A
\input{sub/sub2/sub2}
\end{document}

sub2.tex

\documentclass{standalone}
\begin{document}
B
\end{document}

Setup the code sample, vim main.tex then \ll everything works as expected. Then cd sub and vim sub.tex and :VimtexToggleMain, then run \ll and it fails because it doesn't know where sub/sub2/sub2 is. To fix it we have to do sub2/sub2 which will break compilation in the main file.

Expected behavior

Allowing compilation of a nested standalone document

Actual behavior

Compilation of nested standalone document fails.

Do you use a latexmkrc file?

No

VimtexInfo

System info
  OS: Manjaro Linux
  Vim version: NVIM v0.6.0-dev+116-g35041432b
  Has clientserver: true
  Servername: /tmp/nvim41AJVy/0

VimTeX project: main
  base: main.tex
  root: /home/ccn/Downloads/standalone test
  tex: /home/ccn/Downloads/standalone test/main.tex
  out: /home/ccn/Downloads/standalone test/build/main.pdf
  log: /home/ccn/Downloads/standalone test/build/main.log
  aux: /home/ccn/Downloads/standalone test/build/main.aux
  fls: /home/ccn/Downloads/standalone test/build/main.fls
  main parser: current file verified
  source files:
    main.tex
    sub/sub.tex
    sub/sub2/sub2.tex
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      build_dir: build
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
  viewer: Zathura
    xwin id: 0
  qf: LaTeX logfile
    addqflist: 62
    fix_paths: 63
    set_errorformat: 61
  document class: article
  packages:
    adjcalc
    adjustbox
    collectbox
    currfile
    epstopdf-base
    filehook
    filehook-2020
    filemod-expmin
    gincltex
    graphics
    graphicx
    ifluatex
    ifoddpage
    iftex
    inputenc
    keyval
    kvoptions
    kvsetkeys
    ltxcmds
    shellesc
    standalone
    svn-prov
    trig
    trimclip
    varwidth
    xkeyval
@cuppajoeman cuppajoeman added the bug label Nov 8, 2021
@lervag
Copy link
Owner

lervag commented Nov 9, 2021

Thanks; this is a complicated issue, because the standalone package works in a "non standard" way. But I think we can solve it similar to how I've implemented support for the subfile package. I'll look into it.

lervag added a commit that referenced this issue Nov 9, 2021
lervag added a commit that referenced this issue Nov 9, 2021
@lervag
Copy link
Owner

lervag commented Nov 9, 2021

I think it should work now.

This change may be unexpected for some users who are not aware of the nuance described in your issue. That is, I believe a lot of people would use standalone only for more simple things like a single tikz image, because this update will change the root directory for the local view to that of the real main file. Thus there are some gotchas, e.g.:

.
├── main.tex
├── sub1
    └── sub.tex
├── sub2
    └── sub.tex
└── figures
    ├── tikz1/fig.tex
    └── tikz2/fig.tex

Assume all sub.tex and fig.tex files are \documentclass{standalone}. Then there would be a conflict if you did e.g.

  1. open sub1/sub.tex - \ls - \ll - quit
  2. open sub2/sub.tex - \ls - \ll

Since the root is the same, the auxilliary files will conflict. This is clearly constructed, and I also think it is clearly a user "error". But my point is that I believe this kind of thing may happen to unaware users. I don't have a good idea of a simple way to avoid this.

@lervag lervag closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants