-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
vertical alignment for images #907
Conversation
4c2d1c7
to
f61294f
Compare
f61294f
to
7c8cb47
Compare
macros/core/PGbasicmacros.pl
Outdated
"\\raisebox{-\\height + \\fontcharht\\font`I}{\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}}\n"; | ||
} elsif ($valign eq 'bottom') { | ||
$out = "\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}\n"; | ||
} else { | ||
$out = | ||
"\\raisebox{-0.5\\height + 0.5\\fontcharht\\font`I}{\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}}\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backticks here are causing a problem in BEGIN_TEXT/END_TEXT blocks. This is passed through EV3P and then EV3P_parser in that case, and backticks have special meaning. This results in the following text being passed through the Parser, and this gives "Error: Variable 'I' is not defined in this context; see position 1 of formula 'I" in the output. Then there is an error when LaTeX runs on that. This occurs with your MWE.
I see. I need a clever way to work out the height of a line of text, and I
don't think \baselineskip is right. That's a bit too much.
…On Thu, Aug 17, 2023, 7:23 AM Glenn Rice ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In macros/core/PGbasicmacros.pl
<https://protect2.fireeye.com/v1/url?k=31323334-501d2dca-3132feb7-454455534531-89e352d72b21b4be&q=1&e=c8104558-63ea-4144-8710-b29b9fa4ab14&u=https%3A%2F%2Fgithub.com%2Fopenwebwork%2Fpg%2Fpull%2F907%23discussion_r1297299130>
:
> + "\\raisebox{-\\height + \\fontcharht\\font`I}{\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}}\n";
+ } elsif ($valign eq 'bottom') {
+ $out = "\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}\n";
+ } else {
+ $out =
+ "\\raisebox{-0.5\\height + 0.5\\fontcharht\\font`I}{\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}}\n";
The backticks here are causing a problem in BEGIN_TEXT/END_TEXT blocks.
This is passed through EV3P and then EV3P_parser in that case, and
backticks have special meaning. This results in the following text being
passed through the Parser, and this gives "Error: Variable 'I' is not
defined in this context; see position 1 of formula 'I" in the output. Then
there is an error when LaTeX runs on that. This occurs with your MWE.
—
Reply to this email directly, view it on GitHub
<https://protect2.fireeye.com/v1/url?k=31323334-501d2dca-3132feb7-454455534531-4553b78b5757cb34&q=1&e=c8104558-63ea-4144-8710-b29b9fa4ab14&u=https%3A%2F%2Fgithub.com%2Fopenwebwork%2Fpg%2Fpull%2F907%23pullrequestreview-1582749279>,
or unsubscribe
<https://protect2.fireeye.com/v1/url?k=31323334-501d2dca-3132feb7-454455534531-74c12fdedfe43a8a&q=1&e=c8104558-63ea-4144-8710-b29b9fa4ab14&u=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABEDOADQBRNSZPDYI2U3JM3XVYSMTANCNFSM6AAAAAA3OLLJXI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
You could define this length in the pg.sty file. In that file add
That won't be parsed by PG at all, and so it avoids this issue. |
I declared a length in And now it's using |
I will merge this since the hotfix of this was merged. |
Oops. This wasn't one that was in the hotfix list. Oh, well. It was ready. I just hadn't put my approval on. @pstaabp did. |
This lets you declare vertical alignment for an image relative to the
baseline of any surrounding textsurrounding line of text. Note that right now, an image within text will be middle-aligned in HTML output and bottom-aligned in hardcopy, so there is already an inconsistency there. This changes the default to be "middle", so changing the behavior with hardcopy but not changing it with HTML.To test, take your favorite image as
$image
and run the following. Make sure to look at HTML and hardcopy.