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

LaTeX export fails to correctly escape newlines in titles #599

Open
JasonGross opened this issue Apr 2, 2024 · 0 comments
Open

LaTeX export fails to correctly escape newlines in titles #599

JasonGross opened this issue Apr 2, 2024 · 0 comments

Comments

@JasonGross
Copy link

Python code on colab generated by ChatGPT

import matplotlib.pyplot as plt
import tikzplotlib

# Create a simple plot
plt.figure()
plt.plot([0, 1, 2], [0, 1, 0])
plt.title("Title with Newline\nCharacter")

# Save the plot using tikzplotlib
tikz_code = tikzplotlib.get_tikz_code()

# Print the generated TikZ/PGFPlots code
print(tikz_code)

TeX:

% This file was created with tikzplotlib v0.10.1.
\begin{tikzpicture}

\definecolor{darkgray176}{RGB}{176,176,176}
\definecolor{steelblue31119180}{RGB}{31,119,180}

\begin{axis}[
tick align=outside,
tick pos=left,
title={Title with Newline
Character},
x grid style={darkgray176},
xmin=-0.1, xmax=2.1,
xtick style={color=black},
y grid style={darkgray176},
ymin=-0.05, ymax=1.05,
ytick style={color=black}
]
\addplot [semithick, steelblue31119180]
table {%
0 0
1 1
2 0
};
\end{axis}

\end{tikzpicture}

Expected TeX has Title with Newline \\ Character instead of

Title with Newline
Character
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

1 participant