8000 Let TeX handle newlines itself. · matplotlib/matplotlib@d62b6e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d62b6e2

Browse files
committed
Let TeX handle newlines itself.
Note that it may be worth passing the baselineskip (`Text.get_linespacing()`) as argument to texmanager, but that'll wait for a bigger refactor... for now, let's stick to the old default of 1.25.
1 parent 9626be9 commit d62b6e2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/matplotlib/texmanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def make_tex(self, tex, fontsize):
217217
%% when using psfrag which gets confused by it.
218218
\fontsize{%(fontsize)f}{%(baselineskip)f}%%
219219
\ifdefined\psfrag\else\hbox{}\fi%%
220-
{%(fontcmd)s %(tex)s}\special{matplotlibbaselinemarker}
220+
{\obeylines%(fontcmd)s %(tex)s}\special{matplotlibbaselinemarker}
221221
\end{document}
222222
"""
223223
Path(texfile).write_text(tex_template % {

lib/matplotlib/text.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ def _get_layout(self, renderer):
295295
of a rotated text when necessary.
296296
"""
297297
thisx, thisy = 0.0, 0.0
298-
lines = self.get_text().split("\n") # Ensures lines is not empty.
298+
text = self.get_text()
299+
lines = [text] if self.get_usetex() else text.split("\n") # Not empty.
299300

300301
ws = []
301302
hs = []

0 commit comments

Comments
 (0)
0