-
Notifications
You must be signed in to change notification settings - Fork 211
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
100% width latex-images in naked images are not 100% width in PDF #2412
Comments
Recursively strip final whitespace characters?
We'll get rid of every stray character in LaTeX one day...
…On February 6, 2025 5:37:21 AM GMT-03:00, Alex Jordan ***@***.***> wrote:
This is a subtle spacing issue with naked latex-images in PDF. (It may also be an issue with non-naked images, and not-latex-images, but I haven't investigated.)
A naked image using latex-image in a division will typically be authored in a way that ends like:
```
...
\end{tikzimage}
</latex-image>
</image>
```
This ends up in PTX-generated LaTeX as:
```
...
\end{tikzpicture}
}%
\end{image}%
```
There is a new line there at the end of `\end{tikzpicture}`. This newline is responsible for a small amount of horizontal space to the right of the picture. So if the picture is 100% width, it actually will not quite be flush with the right edge of the surrounding text body. Here you can see this with a naked image/tikz-image I put into the minimal article:
<img width="676" alt="Image" src="https://github.com/user-attachments/assets/e03f3bd3-8862-4f67-9dcf-6086f1315286" />
If I manually alter the tex, adding a `%` so we have:
```
...
\end{tikzpicture}%
}%
\end{image}%
```
then the image comes out at 100%.
I had trouble coming up with an automated way to get a `%` sign in there like that. The author's actual content has a text node like `...\end{tikzimage}
 `, so it's a question how you would insert that `%` there. And you wouldn't want to insert it before other newlines in the author's code. And counting the last line break is not reliable either since they may have additional line breaks at the end.
Maybe it's an unfortunate "author education" situation where they should author the `%` signs?
|
And you might even find an existing template in the file full of such things (pretext-text-utilities.xsl). Or else write a general enough one to go there.
…On February 6, 2025 6:33:25 AM GMT-03:00, Rob Beezer ***@***.***> wrote:
Recursively strip final whitespace characters?
We'll get rid of every stray character in LaTeX one day...
On February 6, 2025 5:37:21 AM GMT-03:00, Alex Jordan ***@***.***> wrote:
>This is a subtle spacing issue with naked latex-images in PDF. (It may also be an issue with non-naked images, and not-latex-images, but I haven't investigated.)
>
>A naked image using latex-image in a division will typically be authored in a way that ends like:
>
>```
> ...
> \end{tikzimage}
> </latex-image>
></image>
>```
>
>This ends up in PTX-generated LaTeX as:
>
>```
> ...
>\end{tikzpicture}
>}%
>\end{image}%
>```
>
>There is a new line there at the end of `\end{tikzpicture}`. This newline is responsible for a small amount of horizontal space to the right of the picture. So if the picture is 100% width, it actually will not quite be flush with the right edge of the surrounding text body. Here you can see this with a naked image/tikz-image I put into the minimal article:
>
><img width="676" alt="Image" src="https://github.com/user-attachments/assets/e03f3bd3-8862-4f67-9dcf-6086f1315286" />
>
>If I manually alter the tex, adding a `%` so we have:
>
>```
> ...
>\end{tikzpicture}%
>}%
>\end{image}%
>```
>then the image comes out at 100%.
>
>
>I had trouble coming up with an automated way to get a `%` sign in there like that. The author's actual content has a text node like `...\end{tikzimage}
 `, so it's a question how you would insert that `%` there. And you wouldn't want to insert it before other newlines in the author's code. And counting the last line break is not reliable either since they may have additional line breaks at the end.
>
>Maybe it's an unfortunate "author education" situation where they should author the `%` signs?
>
>
>
|
Is that sort of stripping something to do in |
I think I would do it in the extraction and in the Latex. Maybe a template in common. Which is not to say assembly is bad, but there is a lot going on there.
…On February 6, 2025 1:35:22 PM GMT-03:00, Alex Jordan ***@***.***> wrote:
Is that sort of stripping something to do in `-assembly`?
|
Ah, I was already doing something in assembly and didn't see this first. Check out #2413 and let me know what you think. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a subtle spacing issue with naked latex-images in PDF. (It may also be an issue with non-naked images, and not-latex-images, but I haven't investigated.)
A naked image using latex-image in a division will typically be authored in a way that ends like:
This ends up in PTX-generated LaTeX as:
There is a new line there at the end of
\end{tikzpicture}
. This newline is responsible for a small amount of horizontal space to the right of the picture. So if the picture is 100% width, it actually will not quite be flush with the right edge of the surrounding text body. Here you can see this with a naked image/tikz-image I put into the minimal article:If I manually alter the tex, adding a
%
so we have:then the image comes out at 100%.
I had trouble coming up with an automated way to get a
%
sign in there like that. The author's actual content has a text node like...\end{tikzimage}

, so it's a question how you would insert that%
there. And you wouldn't want to insert it before other newlines in the author's code. And counting the last line break is not reliable either since they may have additional line breaks at the end.Maybe it's an unfortunate "author education" situation where they should author the
%
signs?The text was updated successfully, but these errors were encountered: