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

Feature suggestion: baseline specification for inclusion in LaTeX #457

Open
user202729 opened this issue Apr 29, 2024 · 1 comment
Open

Comments

@user202729
Copy link

user202729 commented Apr 29, 2024

TikZ has this thing. https://tikz.dev/tikz-scopes#pgf./tikz/baseline

Can we do the same thing in Asymptote (i.e. in asypictureB or asymptote LaTeX package)?

(Rationale: it's listed in https://tex.stackexchange.com/questions/39577/what-are-the-relative-strengths-of-tikz-and-asymptote as one of the arguments against Asymptote.)


I can see an immediate problem: PDF does not provide any way to draw outside the bounding box (is there? I don't know of one).

So you need to pass the parameter of how much to lower the box to the TeX side, then we can simply do https://tex.stackexchange.com/questions/15853/vertical-alignment-of-inline-images .

I can think of two options:

  • Always make the baseline the center, then make Asymptote generate at the center. Pass an optional argument to asy/asypicture environment to specify that you want the baseline to be at point (0, 0) or whatever it is.
  • Use another auxiliary text file to store the amount of shift needed.
@charlesstaats
Copy link
Contributor

To elaborate on the rationale: the exact quote from the stackexchange answer is "you can define the baseline of TikZ pictures so you can align them neatly." So the desired behavior would be to put asymptote pictures side-by-side and easily set then to have the same y=0 coordinate, even if one of them extends up and the other extends down. For instance,

\begin{asy}[baseline=0]
unitsize(1cm);
draw((0, 0) -- (1, 1));
\end{asy}
\begin{asy}[baseline=0]
unitsize(1cm);
draw((0, 0) -- (-1, -1));
\end{asy}

should produce this

  /
 /
/ 
      /
     /
    /

rather than this

  /    /
 /    /
/    /

This does seem desirable, but I'm not sure how to make it happen.

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

2 participants