8000 Fix text.usetex when using xcolor in preamble. · matplotlib/matplotlib@b36ffda · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

8000
Appearance settings

Commit b36ffda

Browse files
anntzerQuLogic
authored andcommitted
Fix text.usetex when using xcolor in preamble.
1 parent 56d9e7c commit b36ffda

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/matplotlib/dviread.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,18 +313,26 @@ def _read(self):
313313
# xxx comment
314314
# down
315315
# push
316-
# down, down
316+
# down
317+
# <push, push, xxx, right, xxx, pop, pop> # if using xcolor
318+
# down
317319
# push
318320
# down (possibly multiple)
319321
# push <= here, v is the baseline position.
320322
# etc.
321323
# (dviasm is useful to explore this structure.)
324+
# Thus, we use the vertical position at the first time the stack depth
325+
# reaches 3, while at least three "downs" have been executed, as the
326+
# baseline (the "down" count is necessary to handle xcolor).
327+
downs = 0
322328
self._baseline_v = None
323329
while True:
324330
byte = self.file.read(1)[0]
325331
self._dtable[byte](self, byte)
332+
downs += self._dtable[byte].__name__ == "_down"
326333
if (self._baseline_v is None
327-
and len(getattr(self, "stack", [])) == 3):
334+
and len(getattr(self, "stack", [])) == 3
335+
and downs >= 4):
328336
self._baseline_v = self.v
329337
if byte == 140: # end of page
330338
return True

0 commit comments

Comments
 (0)
0