Hi everyone! I’m writing an article about astronomy, and I’d like a page-wide schematic picture of the solar system on my title page. This is my code so far:
The problem is that the canvas automatically fits the image to the top and left edges of the page, and so the Sun ends up equidistant from these edges, despite supposedly having coordinates (3,-7). Is it possible to draw shapes where I actually want them to appear on the page, and just crop them if they go out of bounds? Ideally, I would like something like this (this was drawn in Asymptote):
As mentioned in the CeTZ manual, clipping is currently not supported. This means you can’t define a drawing box that restricts where lines are drawn—everything will be rendered regardless of the canvas boundaries.
A workaround is to place your canvas in the center of the page and shift it slightly, so the page edges effectively act as a “clip” for your solar system. You can even set the canvas as the page background:
Yeah, since CeTZ is a package for drawing, it will show a full drawing, so to use negative value to move the drawing into the opposite direction you would have to use move(), although depending on what you need, a place(dx: ..., dy: ..., cetz.canvas()) can be a better solution since it will by default start in the top left corner bypassing page margins if used as background or foreground.