Difference between revisions of "Command/vphantom"

From Wiki
Jump to navigation Jump to search
m
(Framed the example to make it clearer)
 
Line 12: Line 12:
 
<cd:description><!-- the long description of the command goes here -->
 
<cd:description><!-- the long description of the command goes here -->
 
<tt>\vphantom</tt> typesets the supplied content and then throws it away, leaving a 'phantom' i.e. an invisible item that has zero width but the maximum height of the phantom text. This then influences the height of what follows.</cd:description>
 
<tt>\vphantom</tt> typesets the supplied content and then throws it away, leaving a 'phantom' i.e. an invisible item that has zero width but the maximum height of the phantom text. This then influences the height of what follows.</cd:description>
<cd:examples><cd:example title="Aligning the height of square root (radical) signs">\starttext
+
<cd:examples><cd:example title="Aligning the top of square root signs (radicals)">In this example the expressions have been framed to better highlight the differences. The third cube root contains a 'phantom' digit 4 so that its height matches the second one. The first and last don't have this phantom and have a smaller root sign. (Actually, it's the same sized character but lower in the line so it protrudes below the baseline a little.)
 +
 
 +
<context source="yes">
 +
\setuppapersize [A7] [A7]
 +
\starttext
 +
\framed{
 
\startformula
 
\startformula
\sqrt[3]{4n} \ne \sqrt[3] {n}
+
\sqrt[3] {n} \quad \sqrt[3]{4n} \quad \sqrt[3] {\vphantom{4} n} \quad \sqrt[3] {n}
 
\stopformula
 
\stopformula
\startformula
+
}
\sqrt[3]{4n} \ne \sqrt[3] {\vphantom{4} n}
+
\stoptext
\stopformula
+
</context>
\stoptext</cd:example></cd:examples>
+
</cd:example></cd:examples>
 
<cd:notes></cd:notes>
 
<cd:notes></cd:notes>
 
<cd:seealso>
 
<cd:seealso>

Latest revision as of 14:00, 22 August 2021


\vphantom

Summary

The command \vphantom creates an invisible item that has height but no width.

Settings

\vphantom{...}
{...}content

Description

\vphantom typesets the supplied content and then throws it away, leaving a 'phantom' i.e. an invisible item that has zero width but the maximum height of the phantom text. This then influences the height of what follows.

Examples

Aligning the top of square root signs (radicals)

In this example the expressions have been framed to better highlight the differences. The third cube root contains a 'phantom' digit 4 so that its height matches the second one. The first and last don't have this phantom and have a smaller root sign. (Actually, it's the same sized character but lower in the line so it protrudes below the baseline a little.)

\setuppapersize [A7] [A7]
\starttext
\framed{
\startformula
\sqrt[3] {n} \quad \sqrt[3]{4n} \quad \sqrt[3] {\vphantom{4} n} \quad \sqrt[3] {n}
\stopformula
}
\stoptext

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: