texstudio
texstudio copied to clipboard
Hover preview breaks when loading common packages
Environment
- TeXstudio: 4.4.0
- Qt: 6.4.1
- OS: Windows 11
- TeX distribution: texlive
Expected behavior
Expected to see the tooltip popup previews of mathematical formulas, in documents using luacode and loading microtype.
Actual behavior
When I switched to LuaLaTeX the previews couldn't compile properly. The problem occurs when loading microtype.
I tried the workaround of keeping pdfLaTeX just for the previews, but this does not work when loading luacode.
How to reproduce
Change the settings to Preview -> Command: Preview with lualatex. Make sure that the checkbox "Show preview as tooltip on formulas in editor" is ticked.
Minimal non-working example:
\documentclass{article}
\usepackage{microtype}
\begin{document}
$A$ $B$
\end{document}
Hover over a dollar sign in $A$. The preview works as expected. Do the same with $B$. The preview doesn't show. The message "Process exited with error(s)" is displayed.
Similar problem (perhaps less surprising):
Change the settings to Preview -> Command: Preview with pdflatex. Minimal non-working example:
\documentclass{article}
\usepackage{luacode}
\begin{document}
$A$
\end{document}
The preview doesn't show up. The message "Process exited with error(s)" is displayed.
lua can make problems, f. ex. with tikz. In this case unset adv. option for preview as follows:

Of course this will slowdown preview depending on the size/amount of code of the preamble.
For a description on how to find the temp files s. #2785.
The 1rst case (with code given above) doesn't run with option precompile preamble. There is nothing we can do. So deactivate precompile preamble, then inline preview and tooltip preview work:
Details: Compiling with precompiled preamble shows messages like this:
File: mt-LatinModernRoman.cfg 2021/02/21 v1.1 microtype config. file: Latin Mod
ern Roman (RS)
[\directlua]:1: attempt to index a nil value (global 'microtype')
stack traceback:
[\directlua]:1: in main chunk.
MT@ifstreq ...{microtype.if_str_eq([[#1]],[[#2]])}
endcsname
l.111 }
The lua interpreter ran into a problem, so the
remainder of this lua chunk will be ignored.
The 2nd case will succeed when switching to preview with lualatex. You can't use pdflatex here.
@sunderme From my point of view this issue can be closed.