Bug 502417

Summary: LaTeX output is not rendered / not shown (pdflatex, TeXlive 2024, no error shown)
Product: [Applications] LabPlot2 Reporter: Oliver Freyermuth <o.freyermuth>
Component: generalAssignee: Stefan Gerlach <stefan.gerlach>
Status: RESOLVED FIXED    
Severity: normal CC: alexander.semke, stefan.gerlach
Priority: NOR    
Version First Reported In: 2.11.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 2.12
Sentry Crash Report:
Attachments: Screenshot from labplot (no matter whether patch is applied)
PDF created by pdflatex
tex file from /dev/shm created by LabPlot (after application of patch)
Screenshot from fresh labplot build from master

Description Oliver Freyermuth 2025-04-04 16:26:22 UTC
SUMMARY
LaTeX output is not rendered / not shown, but no error is shown. 

STEPS TO REPRODUCE
1. Create a new plot. 
2. Select axis, title, switch to LaTeX mode. 
3. Enter a valid string such as "x axis $a$". 
4. Observe no rendered axis title. 

OBSERVED RESULT
Axis title not rendered, no error shown. 

EXPECTED RESULT
Axis title shown with LaTeX rendering. 

SOFTWARE/OS VERSIONS
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: Gentoo Linux 2.17
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2
TeXlive version: 2024
Ghostscript version: 10.04.0

ADDITIONAL INFORMATION
Entering an invalid LaTeX string, such as:
x axis $a
(missing the trailing $) yields an error (Exit code 1). Checking with strace shows that pdflatex is called, a tex file is created, a pdf is created and read, and everything is purged (including TeX logs). 
Tested all engines:
* pdflatex => bug as described (no output)
* latex => bug as described (no output)
* LuaLaTeX => always show "! Package fontspec Error: " (independent of LaTeX string correctness). 
* XeLaTeX => always shows exit code 1 (independent of LaTeX string correctness). 

Ideas on how to debug this are very welcome, I can certainly extract more information if there is a way to have labplot not clean up intermediate output.
Comment 1 Stefan Gerlach 2025-04-12 10:52:17 UTC
Git commit 9bb5addaedd9ac386dd3d88a7fefdf4e47a20d4b by Stefan Gerlach.
Committed on 12/04/2025 at 10:51.
Pushed by sgerlach into branch 'master'.

Fix LaTeX label font family problem and format temp latex file

M  +24   -16   src/tools/TeXRenderer.cpp

https://invent.kde.org/education/labplot/-/commit/9bb5addaedd9ac386dd3d88a7fefdf4e47a20d4b
Comment 2 Oliver Freyermuth 2025-04-12 17:43:44 UTC
Thanks for the patch! 
Sadly, neither selecting "Latin Modern Regular" in an unpatched LabPlot version nor applying the patch fixes the issue on my end. 
Going by the patch, I set:
file.setAutoRemove(false);
(i.e. commented that line out) and ran again. I found:
/dev/shm/labplot_IlpGgK.tex
then, and running pdflatex revewals the attached PDF. I also attached the .TEX file. 

So all seems to work fine, but thngs are just empty in LabPlot. I also attached a screenshot of the workspace.
Comment 3 Oliver Freyermuth 2025-04-12 17:44:09 UTC
Created attachment 180205 [details]
Screenshot from labplot (no matter whether patch is applied)
Comment 4 Oliver Freyermuth 2025-04-12 17:44:34 UTC
Created attachment 180206 [details]
PDF created by pdflatex
Comment 5 Oliver Freyermuth 2025-04-12 17:44:59 UTC
Created attachment 180207 [details]
tex file from /dev/shm created by LabPlot (after application of patch)
Comment 6 Stefan Gerlach 2025-04-13 08:55:06 UTC
Can you check in the "About dialog" if Poppler is available? Without Poppler the created PDF can't be shown in the plot.
Comment 7 Oliver Freyermuth 2025-04-13 12:31:14 UTC
Sure. How is poppler availability signaled in the "About" dialog? 
I get the following text there:
```
Debug build 
Apr 12 2025, 19:55:32
System: Gentoo Linux
Locale: German,Germany (Decimal point '.', Group separator ','
Number settings: Decimal point '.', Group separator ',', Exponential 'E', Zero digit '0', Percent '%', Positive/Negative sign '+'/'-' (Updated on restart)
Architecture: x86_64-little_endian-lp64
Kernel: linux 6.12.9-gentoo
C++ Compiler: GNU 14.2.1
C++ Compiler Flags: -march=haswell -mabm -O2 -pipe -frecord-gcc-switches -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Werror=undef -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -pedantic -Wzero-as-null-pointer-constant -Wmissing-include-dirs -fdiagnostics-color=always -Wall -Wextra -Wundef -Wpointer-arith -Wunreachable-code -Wunused -Wdeprecated-declarations -fno-omit-frame-pointer -fstack-protector -fexceptions -std=c++17 -O2 -Wcast-align -Wswitch-enum -fvisibility=default -pedantic -Wzero-as-null-pointer-constant
```
and in "Components":
```
LabPlot: 2.11.1
KDE Frameworks: 6.10.0
Qt: Using 6.8.2 and built against 6.8.2
Gentoo Linux (Xcb)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.12.9-gentoo
```
Since I was not sure whether this indicates Poppler availability, I grepped the build log for "poppler" and found the following lines from the configure phase:
```
-- Poppler: Qt6 requires Core                                                                                                                                                                                                               -- Found Poppler_Core: /usr/lib64/libpoppler.so (found version "25.03.0")                                                                                                                                                                   -- Found Poppler_Qt6: /usr/lib64/libpoppler-qt6.so (found version "25.03.0")                                                                                                                                                                -- Found Poppler: /usr/lib64/libpoppler.so;/usr/lib64/libpoppler-qt6.so (found suitable version "25.03.0", minimum required is "0.62.0") found components: Qt6                                                                               * Poppler (required version >= 0.62.0), A PDF rendering library, <https://poppler.freedesktop.org/>                                                                                                                                        
```
So it seems it has correctly linked against Poppler.
Comment 8 Stefan Gerlach 2025-04-13 21:00:30 UTC
Can you try the latest development version? There are several fixes which may address this issue.
Comment 9 Oliver Freyermuth 2025-04-14 01:09:04 UTC
Indeed, that did the trick! I tried with current master, i.e. version 2.11.0-1492-g7bc8ec4b6, and now it works! 
The result is somehow blurry as soon as greek characters are involved (see attached screenshot), but the bug itself is solved. So I think we can close this issue, or do you want to keep it open until a new release is cut?
Comment 10 Oliver Freyermuth 2025-04-14 01:09:34 UTC
Created attachment 180239 [details]
Screenshot from fresh labplot build from master
Comment 11 Alexander Semke 2025-04-16 06:37:26 UTC
(In reply to Oliver Freyermuth from comment #9)
> Indeed, that did the trick! I tried with current master, i.e. version
> 2.11.0-1492-g7bc8ec4b6, and now it works! 
> The result is somehow blurry as soon as greek characters are involved (see
> attached screenshot), but the bug itself is solved. So I think we can close
> this issue, or do you want to keep it open until a new release is cut?

The problem with the blurry result for small(er) labels sizes (should look better if you zoom into the worksheet) is already tracked in 466949. We can close this ticket. Thank you for reporting this issue!