diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-topgraph.html')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-topgraph.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-topgraph.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-topgraph.html new file mode 100644 index 00000000000..05632d25f2f --- /dev/null +++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-topgraph.html @@ -0,0 +1,52 @@ +<head> +<title>UK TeX FAQ -- question label topgraph</title> +</head><body> +<h3>Top-aligning imported graphics</h3> +<p/>When TeX sets a line of anything, it ensures that the base-line of +each object in the line is at the same level as the base-line of the +final object. (Apart, of course, from <code>\</code><code>raisebox</code> commands...) +<p/>Most imported graphics have their base-line set at the bottom of the +picture. When using packages such as <i>subfig</i>, one often +wants to align figures by their tops. The following odd little bit of +code does this: +<blockquote> +<pre> +\vtop{% + \vskip0pt + \hbox{% + \includegraphics{figure}% + }% +} +</pre> +</blockquote><p> +The <code>\</code><code>vtop</code> primitive sets the base-line of the resulting object to +that of the first “line” in it; the <code>\</code><code>vskip</code> creates the illusion +of an empty line, so <code>\</code><code>vtop</code> makes the very top of the box into the +base-line. +<p/>In cases where the graphics are to be aligned with text, there is a +case for making the base-line one ex-height below the top of the box, +as in: +<blockquote> +<pre> +\vtop{% + \vskip-1ex + \hbox{% + \includegraphics{figure}% + }% +} +</pre> +</blockquote><p> +A more LaTeX-y way of doing the job (somewhat inefficiently) uses +the <i>calc</i> package: +<blockquote> +<pre> +\usepackage{calc} +... +\raisebox{1ex-\height}{\includegraphics{figure}} +</pre> +</blockquote><p> +(this has the same effect as the text-align version, above). +<p/>The fact is, <em>you</em> may choose where the base-line ends up. This +answer merely shows you sensible choices you might make. +<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=topgraph">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=topgraph</a> +</body> |