-
Notifications
You must be signed in to change notification settings - Fork 177
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
l3backend
: dvips
driver for draw
does not properly handle scoped boxes/coffins
#1504
Comments
Drat: I had hoped to avoid having to manually save/restore stuff as this more-or-less relies on internals of how |
See #1504 - needs a bit of testing yet.
Not sure how safe it is but adding this to the example...
produces dvisvgm also manages to understand this dvips syntax enough and the resulting svg looks like |
@davidcarlisle Your idea and my original approach to the box insertion share a common issue. By issuing \documentclass[border=10pt]{standalone}
\usepackage{l3draw}
\begin{document}
\ExplSyntaxOn
\draw_begin:
\color_select:n { red }
\draw_path_circle:nn { 0cm , 0cm } { 1cm }
\draw_path_use_clear:n { stroke }
\hbox_set:Nn \l_tmpa_box {foo}
\draw_box_use:N \l_tmpa_box
\draw_path_circle:nn { 0cm , 0cm } { 2cm }
\draw_path_use_clear:n { stroke }
\draw_end:
\ExplSyntaxOff
\end{document} gives the wrong result with |
I think things are OK now - testing suggests so. |
I saw as I posted that you'd just done a checkin saving and restoring explicitly (which looks cleaner anyway than relying on dvips output quite so much). but I'm surprised it closes a scope if used as suggested. The idea was you'd end up with
so the save is in the outer context and the two empty scopes do nothing, then you do the same wtih restore so following text should be in the original scope. |
I meant that if you end up with for example
then the content will come out black not red. As a concrete example, using \documentclass{article}
\usepackage{l3draw}
\begin{document}
\ExplSyntaxOn
\cs_set_protected:Npn \__draw_backend_scope_begin:
{ \__draw_backend_literal:n {
@endspecial ~ save ~ @beginspecial } }
\cs_set_protected:Npn \__draw_backend_scope_end:
{ \__draw_backend_literal:n { @endspecial ~ restore ~ @beginspecial} }
\draw_begin:
\color_select:n { red }
\draw_scope_begin:
\draw_scope_end:
\draw_path_moveto:n { 0cm, 0cm }
\draw_path_lineto:n { 10cm, 0cm }
\draw_path_moveto:n { 5cm, 0cm }
\draw_path_lineto:n { 5cm , 5cm }
\draw_path_use_clear:n { stroke }
\draw_end:
\ExplSyntaxOff
\end{document} with and without the lines commented. (You also see the line thickness revert to the one not set by |
@davidcarlisle BTW, |
ah if you get stuf between the begin and end that would be bad:, agreed:-) |
It seems that the PS code generated by the
l3draw
driver/backend fordvips
is not correct so that a stack underflow error occurs when boxes or coffins are scoped inside al3draw
environment. No error occurs if the box/coffin is not scoped.Consider the following MWE (also see this issue on TeX.SX where some ideas regarding the reason for this issue have been mentioned already):
Steps
latex
to produce a DVI file;dvips
to produce PS file;The text was updated successfully, but these errors were encountered: