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

No figure if file name contains space #21

Open
dflvunoooooo opened this issue Dec 3, 2023 · 8 comments
Open

No figure if file name contains space #21

dflvunoooooo opened this issue Dec 3, 2023 · 8 comments

Comments

@dflvunoooooo
Copy link

If there is a space in the Latex document containing the gnuplottex code, the figure will be created but not displayed in Latex. Maybe because the created pdf and tex files from gnuplottex contain " in them.

A minimalistic example in a file named test empty.tex:

\documentclass{scrreport}

\usepackage[siunitx, subfolder]{gnuplottex}

\begin{document}
	
\begin{figure}
	\centering
	\begin{gnuplot}[terminal=cairolatex, terminaloptions=color]
		set key box top left
		set key width 4
		set key height 0.25
		set key spacing 1.2
		set key opaque
		set sample 1000
		set xr [-5:5]
		set yr [-1:1]
		plot sin(x) title "$\sin(x)$"
	\end{gnuplot}
	\caption{This is a simple example using the cairolatex-terminal.}
	\label{pic:cairolatex}
\end{figure}

\end{document}

Screenshot_20231203_225224

@larskotthoff
Copy link
Owner

Thanks for your report -- when I try to run your code I get

(./gnuplottex/test-gnuplottex-fig1.tex
! Undefined control sequence.
l.82     \definecolor
                 {tbcol}{rgb}{1,1,1}%

How exactly are you compiling this, and what's your TeX installation?

@dflvunoooooo
Copy link
Author

dflvunoooooo commented Dec 4, 2023

Thank you for your quick answer. I am using texlive with texstudio and compiling with XeLatex and shell escape for gnuplottex on linux. Otherwise there is nothing special.

I don't see, where the error regarding a color is coming from.

Edit: Ah, wait a minute. Even more minimalistic:

\documentclass{scrreport}

\usepackage[siunitx, subfolder]{gnuplottex}

\begin{document}
	
\begin{figure}
	\centering
	\begin{gnuplot}[terminal=cairolatex]
		plot sin(x) title "$\sin(x)$"
	\end{gnuplot}
	\caption{This is a simple example using the cairolatex-terminal.}
	\label{pic:cairolatex}
\end{figure}

\end{document}

@larskotthoff
Copy link
Owner

Ok, it works if I include the xcolor package and exclude the siunitx option, which caused another error. Then everything works fine and the plot is produced.

Are you running this on Linux, Windows, Mac OS?

@dflvunoooooo
Copy link
Author

dflvunoooooo commented Dec 4, 2023

If I add the xcolor option like this usepackage[xcolor]{gnuplottex}, it raises the error Unknown option "xcolor" for package "gnuplottex". \ProcessOptions\relax. I didn't have an error for siunitx.

I run it under linux. Here is a picture of all three created files.

Screenshot_20231204_110607

@larskotthoff
Copy link
Owner

Ah, ok, I needed to include a space in the file name. I can reproduce the bug.

It looks like the conversion of the figure actually works, just the check whether the file exists fails. There's multiple levels of quoting going on here and I'm not sure how to fix this. For now, I'd recommend to simply not have spaces in your file names.

And xcolor is a separate package, not an option.

@dflvunoooooo
Copy link
Author

dflvunoooooo commented Dec 4, 2023

xcolor is a package and you mentioned that. I miss read that.

Yes, it is working if no spaces are used in the filename.

Edit: It is working if I rename both files with the "" in the name and remove those. So the problem seems to be, that the filename is not recognised because of the "". Do you know where they are added?

@larskotthoff
Copy link
Owner

The quotes are added automatically by TeX. And yes, the problem is just handling the quoting at different levels in the code.

@tobiasBora
Copy link

For references, I solved it in my project via this solution in my project https://github.com/leo-colisson/robust-externalize , not sure if you got the same issue: https://tex.stackexchange.com/questions/418670/avoid-quotation-marks-when-using-jobname-or-currfilename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants