Math & ScienceVertical Space in Math Mode

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
lo2
Posts: 15
Joined: Wed Oct 21, 2009 6:31 pm

Vertical Space in Math Mode

Post by lo2 »

I am trying to build the following:

Code: Select all

\documentclass[danish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\usepackage{babel}
\usepackage{ae}
\usepackage{fancyhdr}
\usepackage[pdftex]{graphicx}
\geometry{verbose,letterpaper,bmargin=2cm,tmargin=2cm}
\pagestyle{fancy}
\title{Blækregning}
\author{Name - bnc776}
\fancyhead[LE,RO]{side \thepage  $\ $/ \pageref{LastPage} -- \LaTeX}
\chead{}
\lhead{Name}
\begin{document}
\newcommand{\vetar}[4]{\left ( \begin{array}{cc} #1 & #3 \\ #2 & #4  \end{array} \right ) }
\newcommand{\vecar}[2]{\left ( \begin{array}{c} #1 \\ #2 \end{array} \right ) }
\newcommand{\vedar}[3]{\left ( \begin{array}{c} #1 \\ #2 \\ #3 \end{array} \right ) }
\section{Lynopgave}
\tableofcontents{} 
\subsection{1.1}
Vi har de to flg. grafer, for funktionerne:
\[
f_1(x)=\frac{x^2-7}{x+\sqrt{7}} \vspace(12 pt) \mathrm{og} \vspace(12 pt) f_2(x)=\frac{x^2-7}{x+2.645751311}
\]
\end{document}
The errors I get are these:

Code: Select all

Missing number, treated as zero f_1(x)=\frac{x^2-7}{x+\sqrt{7}} \vspace(
Illegal unit of measure (pt inserted) f_1(x)=\frac{x^2-7}{x+\sqrt{7}} \vspace(
Missing number, treated as zero ...rt{7}} \vspace(12 pt) \mathrm{og} \vspace(
Illegal unit of measure (pt inserted) ...rt{7}} \vspace(12 pt) \mathrm{og} \vspace(
 \fancyhead's `E' option without twoside option is useless on input line 13. \fancyhead's `E' option without twoside option is useless
 Reference `LastPage' on page 1 undefined on input line 27.
 There were undefined references.
Last edited by localghost on Mon Sep 03, 2012 8:03 pm, edited 2 times 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.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Vertical Space in Math Mode

Post by cgnieder »

\vspace's argument is no different than most other arguments: it's enclosed by braces:

Code: Select all

\vspace{12pt}
This won't give you the result you're hoping for, though. You might want to use one of amsmath's aligning environments together with its command \intertext:

Code: Select all

\documentclass[danish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\usepackage{babel}
\usepackage{amsmath}
\begin{document}


\begin{align*}
 f_1(x) &= \frac{x^2-7}{x+\sqrt{7}}
 \intertext{og} \\
 f_2(x) &= \frac{x^2-7}{x+2.645751311}
\end{align*}
\end{document}
Regards
site moderator & package author
lo2
Posts: 15
Joined: Wed Oct 21, 2009 6:31 pm

Vertical Space in Math Mode

Post by lo2 »

cgnieder wrote:\vspace's argument is no different than most other arguments: it's enclosed by braces:

Code: Select all

\vspace{12pt}
This won't give you the result you're hoping for, though. You might want to use one of amsmath's aligning environments together with its command \intertext:

Code: Select all

\documentclass[danish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{geometry}
\usepackage{babel}
\usepackage{amsmath}
\begin{document}


\begin{align*}
 f_1(x) &= \frac{x^2-7}{x+\sqrt{7}}
 \intertext{og} \\
 f_2(x) &= \frac{x^2-7}{x+2.645751311}
\end{align*}
\end{document}
Regards
Ok so this structure cannot be obtained by using the \[ and \] method??
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Vertical Space in Math Mode

Post by cgnieder »

Well, one you do some hacking but that would not be what \[ and \] are meant for.

It is generally advised and agreed by many LaTeX users that every document doing serious maths should use amsmath.

There are some good manuals about mathmode and amsmath's features:
  • mathmode - generally about math mode
  • amsmath - the amsmath manual
  • mathtools - the mathtools manual; mathtools offers some improvements on amsmath (and of course loads it itself!)
Regards
site moderator & package author
Post Reply