Text FormattingBest Practice for additional blank vertical Space

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
lo2
Posts: 15
Joined: Wed Oct 21, 2009 6:31 pm

Best Practice for additional blank vertical Space

Post by lo2 »

Hi there I have been using this to make space between lines:

Code: Select all

\\
\\
I know it is not the correct way, but so far I have not been able to find a universal way of doing this, that is also proper. So what should I do?

I have this example where I want to insert a graph, in the shape of of JPG. And then I want to have some text where I comment on the graph, but I would like there to be space between the graph and that piece of text and more space to the coming thing. Here is my example:

Code: Select all

Den første graf for $f_1$ ses her:
\\
\\
\centering
\includegraphics[height=80mm]{graf1.jpg}
\newline
\textit{Kommentarer til grafen}
\\
\\
Last edited by localghost on Mon Sep 03, 2012 9:07 pm, edited 1 time in total.

Recommended reading 2024:

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

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

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Best Practice for additional blank vertical Space

Post by cgnieder »

The code above shouldn't even compile but give the error message:
! LaTeX Error: There's no line here to end.
What the best way is to insert vertical space at a given point in a document depends on its logical function: is it to separate paragraphs? Or items in a list? Or the space above a section heading? All those cases would be treated differently.

What you want to do sounds like you want to add a caption to a figure. In that case the best thing to do would be to actually declare it that way:

Code: Select all

\documentclass[danish]{article}
\usepackage[draft]{graphicx}
\begin{document}

\begin{figure}
 \centering
 \includegraphics{picture.eps}
 \caption{This is a caption to the figure.}
\end{figure}

\end{document}
There would be lots of ways for customizing the caption (including its vertical distance from the picture), some of them depending on the document class in use.

If you really need to include vertical space there still are:
  • \smallskip
  • \medskip
  • \bigskip
  • \vspace{<dim>}
Regards
site moderator & package author
lo2
Posts: 15
Joined: Wed Oct 21, 2009 6:31 pm

Re: Best Practice for additional blank vertical Space

Post by lo2 »

Ok how would you include a .jpg wit this?

And is there any way of scaling it, using thus option?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Best Practice for additional blank vertical Space

Post by Stefan Kottwitz »

lo2 wrote:I know it is not the correct way, but so far I have not been able to find a universal way of doing this, that is also proper.
It's good that you ask about it! It's correct, using \\ just to get vertical space is not the right way. A universal way is easy to tell, when you exactly know what you mean - spacing aroung figures, or lists, or any centered displayed things.

Clemes gave very good advice! I noticed it when writing, so what should I tell more...

Perhaps: figures are floating, which is very good for automatic page breaking. Add options for placement, such as \begin{figure}[ht] for placing right here or at the top of a page, or \begin{figure}[htbp!] for very relaxed placement.

The draft option above is not for actual including pictures, just for a draft without, so omit it to see pictures. Scaling is possible, as you did it.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Best Practice for additional blank vertical Space

Post by cgnieder »

The \includegraphics command is the same that you used so including a JPG stays exactly the same, also the options like scaling or specifying a width. What changes are several other things:
  1. the markup of the code, obviously
  2. the graphic is now allowed to float letting LaTeX choose the best place to fit (this might need tweaking after the document is ready)
  3. the figures marked this way get numbered and can be labelled with \label and then be referred to with \ref
  4. one can create a list of figures using the \listoffigures command
Have you read some introductory literature to LaTeX already?

Regards

PS: I wrote this while Stefan posted his answer, hence the overlap :)
site moderator & package author
lo2
Posts: 15
Joined: Wed Oct 21, 2009 6:31 pm

Best Practice for additional blank vertical Space

Post by lo2 »

Stefan_K wrote:
lo2 wrote:I know it is not the correct way, but so far I have not been able to find a universal way of doing this, that is also proper.
It's good that you ask about it! It's correct, using \\ just to get vertical space is not the right way. A universal way is easy
to tell, when you exactly know what you mean - spacing aroung figures, or lists, or any centered displayed things.

Clemes gave very good advice! I noticed it when writing, so what should I tell more...

Perhaps: figures are floating, which is very good for automatic page breaking. Add options for placement, such as \begin{figure}[ht] for placing right here or at the top of a page, or \begin{figure}[htbp!] for very relaxed placement.

The draft option above is not for actual including pictures, just for a draft without, so omit it to see pictures. Scaling is possible, as you did it.

Stefan
Ok well I am not exactly sure I understand what you mean. So could you please give me an example of how you would include a graph, which is displayed in a .jpg file?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Best Practice for additional blank vertical Space

Post by Stefan Kottwitz »

Just use Clemens's example, and perhaps test my advice regarding the options.

Clemens wrote .eps, but it works for .jpg with the same code (if you use pdfLaTeX - you do it for sure because you already use .jpg).

Stefan
LaTeX.org admin
Post Reply