APEXCalculus / APEXCalculusPTX

In-progress conversion of APEX Calculus to PreTeXt
6 stars 20 forks source link

Image adjustments: graphs with endpoints on closed intervals #299

Closed sean-fitzpatrick closed 4 months ago

sean-fitzpatrick commented 4 months ago

This is mostly a reminder to myself, although if anyone else has spotted images that don't look right, it would be useful to know what they are!

An example is the image in this exercise

The function has a square root, which imposes an endpoint on the domain.

In the latex-image-preamble, we have a bunch of graph styles created by @Alex-Jordan that correspond to various scenarios, like a curve that continues indefinitely (arrows on the ends), or one with endpoints (closed interval), or one where the endpoints are missing (open interval).

But if I am plotting something like \sqrt{6-x^2} using the closed style, I run into a problem: the solid dots at the ends are provided by the arrows library, and it wants to draw things so that the edge of the dot is at the last point on the graph, but we want the centre of the dot there. Since the square root of 6 is irrational, there's the additional problem that none of our sample points will land right on it, so there will be a noticeable gap between the endpoint and the x axis (where the endpoint should be).

There's also a consistency issue: the {Circle} from the arrows library draws a circle that's around 2pt or 3pt, but elsewhere, in places where @APEXCalculus added the dots manually, those circles are 1.5pt, and the size difference is sometimes apparent.

Fixing these is easy, now that I know (a) what the problem is, and (b) how to fix it. (Don't use the arrows library, and draw the dots manually.) But there are lots of images!

So we need to:

I can tackle these as I notice them, or somebody can suggest a more systematic way of going through everything!

sean-fitzpatrick commented 4 months ago

I got another suggestion on stack exchange that seems to work better than my solution.

I could make that change to the global styling and it should take care of things.

But as pointed out there, if we use thick for the line style, circles will be 2.4pt. So probably I should search for all the 1.5pt circles, and either adjust the size, or change the TikZ code to use the global styling.

APEXCalculus commented 4 months ago

Backing up a bit: For images in the text (not the Exercises), I see the tikzpicture environment creating the images. It seems the soliddot command is being used to create the dots; is a fix as simple as defining soliddot to be 2.4pts in size? If so that seems ideal.

In the Exercises, it seems the images have been converted to a webworks language. How do we fix those? I can't tell where the tikz source for those images is held anymore apart from the APEXCalculusV5 repo.

On Wed, May 15, 2024 at 5:39 PM Sean Fitzpatrick @.***> wrote:

I got another suggestion on stack exchange https://tex.stackexchange.com/questions/718031/pgfplot-on-closed-interval-doesnt-reach-endpoints/ that seems to work better than my solution.

I could make that change to the global styling and it should take care of things.

But as pointed out there, if we use thick for the line style, circles will be 2.4pt. So probably I should search for all the 1.5pt circles, and either adjust the size, or change the TikZ code to use the global styling.

— Reply to this email directly, view it on GitHub https://github.com/APEXCalculus/APEXCalculusPTX/issues/299#issuecomment-2113498707, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5OF4WZEMCSPCXKBCDEZTZCPIY5AVCNFSM6AAAAABHY54ZJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJTGQ4TQNZQG4 . You are receiving this because you were mentioned.Message ID: @.***>

sean-fitzpatrick commented 4 months ago

TikZ source for images in WeBWorK is in the PreTeXt source. You should be able to find it just the same as in the main text.

What I would suggest:

Since we have all these global style commands, we should use them, now that I know how to fix the positioning of the arrowheads.

APEXCalculus commented 4 months ago

I agree with the bullet-point ideas.

I now see the tikz code in the webwork. While I haven't updated my APEXCalculusPTX repo on my laptop for a while, I didn't think it was too far out of date. On it all webwork images were in pg-code. I see online that they are just tikzpictures.

On Thu, May 16, 2024 at 9:56 AM Sean Fitzpatrick @.***> wrote:

TikZ source for images in WeBWorK is in the PreTeXt source. You should be able to find it just the same as in the main text.

What I would suggest:

Since we have all these global style commands, we should use them, now that I know how to fix the positioning of the arrowheads.

  • where there is TikZ source with the line style set by hand, change it to the corresponding global style
  • for dots that are not an endpoint of a graph (i.e. created as an arrowhead), change the size to 2.4pt to match the arrowheads
  • define that dot style globally, so that if we change our minds, we only have to change the size in one place

— Reply to this email directly, view it on GitHub https://github.com/APEXCalculus/APEXCalculusPTX/issues/299#issuecomment-2115323756, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5OF2H7NVDMMS3AGUAOMDZCS3JNAVCNFSM6AAAAABHY54ZJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGMZDGNZVGY . You are receiving this because you were mentioned.Message ID: @.***>

sean-fitzpatrick commented 4 months ago

I think I got rid of the PG graphs last summer!

APEXCalculus commented 4 months ago

I figured. I never miss an opportunity to make myself look like a fool.

On Thu, May 16, 2024 at 10:15 AM Sean Fitzpatrick @.***> wrote:

I think I got rid of the PG graphs last summer!

— Reply to this email directly, view it on GitHub https://github.com/APEXCalculus/APEXCalculusPTX/issues/299#issuecomment-2115369270, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABT5OF5DOEGP3MLWZXWLPULZCS5RHAVCNFSM6AAAAABHY54ZJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGM3DSMRXGA . You are receiving this because you were mentioned.Message ID: @.***>

sean-fitzpatrick commented 4 months ago

I have a pull request coming soon for this. There is a TikZ option like shorten <=-2.4pt, shorten >=-2.4pt you can use when the arrow heads don't go quite as far as you'd like. (Here, 2.4 pt is the size of the circle when the line style is thick.)

But this is sometimes still not perfect: if you don't have a sample sufficiently close to the endpoint, you don't get the dot in the right place.

So I've changed some of those graphs so that the dots are placed using \addplot [soliddot] instead, which looks better t o me.

sean-fitzpatrick commented 4 months ago

Completed (I hope!) with #301