I have observed this as well. A MWE is added here.
MWE/test/test.tex - main file
MWE/macros.tex - definition of some macros
Observations:
Document compiles correctly.
Idefix -> preview selection/parentheses works.
Tooltip preview does not work, log shows trouble finding macros.tex.
Tooltip preview starts working again if either of the following are true:
a. \input is used with absolute path instead of relative path.
b. \input is placed in the document instead of the preamble. In this case, the previews do not seem to recognize the macros in the macros.tex file
Placing \input in the document instead of preamble is fine for macros but, not if the file being input contains any preamble-only commands.
the issue that the compilation of a "preview"-tex-file is taking place in the temp directory. Hence preamble which have relative paths in it, don't work.
I don't think that I want to find a work-around for this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From what I understand, the workaround is already there in the implementation of Idefx -> Preview Selection/Paranthesis. When select the equation in the example I attached to my previous comment and press Idefx -> Preview Selection/Paranthesis, TexStudio does two things:
Creates a temp file (lets call this temp1.tex) with the contents \documentclass{article}
\usepackage{amsmath}
\input{C:/**absolute_path**/MWE/macros.tex}
\usepackage[active,tightpage]{preview}
\usepackage{varwidth}
\AtBeginDocument{\begin{preview}\begin{varwidth}{\linewidth}}
\AtEndDocument{\end{varwidth}\end{preview}}
\pagestyle{empty}
Here TexStudio is able to parse my relative path and convert it to an absolute path.
2 Creates another temp file (let's call this temp2.tex) with the contents %&temp1
\begin{document}
\begin{equation*}
f\left(t\right)=g\left(t\right), \forall t\in\ropen{0,\infty}.
\end{equation*}
\end{document}
temp2.tex then compiles correctly.
Whem I hover over \begin, TexStudio again creates two temp files. This time though, the path is not converted to absolute path in temp1.tex. Also, a precompiled temp1.fmt is no longer used in temp2.tex like before (this is probably because pdflatex fails to create the fmt file because the relative path is not correct). That is, I get
Of course, this time, temp2.tex does not compile correctly.
Is there no way to replicate the existing functionality of Idefx -> Preview Selection/Paranthesis (which parses and converts relative paths to absolute paths before exporting temp1.tex) when compiling the tooltip previews?
Last edit: Rushi 2018-02-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have observed this as well. A MWE is added here.
MWE/test/test.tex - main file
MWE/macros.tex - definition of some macros
Observations:
a. \input is used with absolute path instead of relative path.
b. \input is placed in the document instead of the preamble. In this case, the previews do not seem to recognize the macros in the macros.tex file
Placing \input in the document instead of preamble is fine for macros but, not if the file being input contains any preamble-only commands.
Last edit: Rushi 2018-02-11
the issue that the compilation of a "preview"-tex-file is taking place in the temp directory. Hence preamble which have relative paths in it, don't work.
I don't think that I want to find a work-around for this.
Hi Jan,
From what I understand, the workaround is already there in the implementation of
Idefx -> Preview Selection/Paranthesis
. When select the equation in the example I attached to my previous comment and pressIdefx -> Preview Selection/Paranthesis
, TexStudio does two things:temp1.tex
) with the contents\documentclass{article} \usepackage{amsmath} \input{C:/**absolute_path**/MWE/macros.tex} \usepackage[active,tightpage]{preview} \usepackage{varwidth} \AtBeginDocument{\begin{preview}\begin{varwidth}{\linewidth}} \AtEndDocument{\end{varwidth}\end{preview}} \pagestyle{empty}
Here TexStudio is able to parse my relative path and convert it to an absolute path.
2 Creates another temp file (let's call this
temp2.tex
) with the contents%&temp1 \begin{document} \begin{equation*} f\left(t\right)=g\left(t\right), \forall t\in\ropen{0,\infty}. \end{equation*} \end{document}
temp2.tex then compiles correctly.
Whem I hover over
\begin
, TexStudio again creates two temp files. This time though, the path is not converted to absolute path intemp1.tex
. Also, a precompiled temp1.fmt is no longer used in temp2.tex like before (this is probably because pdflatex fails to create the fmt file because the relative path is not correct). That is, I gettemp1.tex:
\documentclass{article} \usepackage{amsmath} \input{../macros.tex} \usepackage[active,tightpage]{preview} \usepackage{varwidth} \AtBeginDocument{\begin{preview}\begin{varwidth}{\linewidth}} \AtEndDocument{\end{varwidth}\end{preview}} \pagestyle{empty}
temp2.tex
\documentclass{article} \usepackage{amsmath} \input{../macros.tex} \usepackage[active,tightpage]{preview} \usepackage{varwidth} \AtBeginDocument{\begin{preview}\begin{varwidth}{\linewidth}} \AtEndDocument{\end{varwidth}\end{preview}} \pagestyle{empty} \begin{document} \begin{equation*} f\left(t\right)=g\left(t\right), \forall t\in\ropen{0,\infty}. \end{equation*} \end{document}
Of course, this time, temp2.tex does not compile correctly.
Is there no way to replicate the existing functionality of
Idefx -> Preview Selection/Paranthesis
(which parses and converts relative paths to absolute paths before exportingtemp1.tex
) when compiling the tooltip previews?Last edit: Rushi 2018-02-11
I will look into it.