General ⇒ relative image paths from \input{} file
relative image paths from \input{} file
I have one main file, which references several other .tex files using the \input{directory1/file1.tex} command. However within file1.tex there are \includegraphics{picture1} commands, where picture1 exists inside directory1 with the tex file. However, when running the main file, I get errors that picture1 is not found, because LaTex is looking in top-most directory (the folder with the main program, not directory1.
Both file1 and picture1 are automatically generated, and refreshed often, so it would be best to not have to move picture1 out of the inclosing folder by hand. Thank you for any advice you have on straightening this out!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Re: relative image paths from \input{} file
If the files are automatically generated, can you not generate/create them with names that take the directory structure into account. ie.
directoryx/filex.tex
directoryx/picturex
rather than
filex.tex
picturex
Re: relative image paths from \input{} file
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
relative image paths from \input{} file
Best regards and welcome to the board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10