Graphics, Figures & TablesCreating n x lineheight space to contain graphic?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Creating n x lineheight space to contain graphic?

Post by Julian_S_Moore »

I have a small graphic (18 pt height).

I wish to place it between two paragraphs of text, but not upset the alignment of lines across pages of the book, so want to place it in a space of n x \baselinksip (nominally 12pt). BTW , I'm using the Memoir class

How (without scaling the graphic - I want extra white space) can I precisely control the space above and the space below the graphic? (must be able to adjust the space above and below by eye, in units of e.g. pts)

There is no MWE.. two pageful's of things that don't work would not be helpful.

If you have a suggestion I'll try it and post the results back... then we might be able to look at it again, but right now I'm stuck.

Thanks people!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Creating n x lineheight space to contain graphic?

Post by gmedina »

Hi,

you can change the \intextsep and \belowcaptionskip lengths. The first one specifies the vertical space added below and above a float positioned in the middle of text; the second one adds vertical space below the caption (of course, if the caption appears at the top of the float, then you might consider not changing \belowcaptionskip).

You can find the default value for those lengths using the \the command right before the length command, in the body of your document.

A little example:

Code: Select all

\documentclass{memoir}
\usepackage{lipsum}% just to generate some text

\setlength\intextsep{0pt plus 1pt minus 1pt}
\setlength\belowcaptionskip{0pt}

\begin{document}

\lipsum[1]
\begin{figure}[!ht]
  \centering
  \rule{5cm}{3cm}
  \caption{test figure}
  \label{fig:test}
\end{figure}
\lipsum[1]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Re: Creating n x lineheight space to contain graphic?

Post by Julian_S_Moore »

Thanks gmedina!

That worked perfectly... though when I embedded it into my own structure using \begin{center}.... \end(center} I got extra spacing... so I removed that and just hspaced the graphic.

Problem solved... prior to posting I had tried all sorts of boxes and fiddling with various other skips... maybe they were also messed up by the center environment. Who knows! Don't care! Thanks!
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Creating n x lineheight space to contain graphic?

Post by gmedina »

Julian_S_Moore wrote:...though when I embedded it into my own structure using \begin{center}.... \end(center} I got extra spacing...
Yes. The center environment adds extra vertical spacing; you can avoid this extra spacing using the \centering command instead.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Creating n x lineheight space to contain graphic?

Post by Julian_S_Moore »

gmedina wrote:
Julian_S_Moore wrote:...though when I embedded it into my own structure using \begin{center}.... \end(center} I got extra spacing...
Yes. The center environment adds extra vertical spacing; you can avoid this extra spacing using the \centering command instead.
My jaw dropped to discover this "feature" is obviously by design... there is nothing about that in the command help of TeXnicCenter (which I think is repackaged standard documentation), nor can I find that information in e.g. TeX by Topic, The Beginner's Guide to LaTeX... at which point one has to say: how many references does one have to check to find out what one needs to know? (Hence the request for a Dictionary - your suggestions were welcome (TeX by Topic is particularly good), but is there not one single place one can look?

I thought I must be missing something... looked for a "LaTeX Reference Manual" found this and...

centre
The center environment allows you to create a paragraph consisting of lines that are centered within the left and right margins on the current page. Each line must be terminated with the string \\.

See also: \centering
\centering
This declaration corresponds to the center environment. This declaration can be used inside an environment such as quote or in a parbox. The text of a figure or table can be centered on the page by putting a \centering command at the beginning of the figure or table environment.

Unlike the center environment, the \centering command does not start a new paragraph; it simply changes how LaTeX formats paragraph units. To affect a paragraph unit’s format, the scope of the declaration must contain the blank line or \end command (of an environment like quote) that ends the paragraph unit.
I can't find any mention of vertical effects anywhere <sigh>

If not for people like you I would never have been able to make this stuff work.

Thank you , thank you, thank you (all)!
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

Re: Creating n x lineheight space to contain graphic?

Post by phi »

Post Reply