Text Formattingfunctions \author{} and \title{} don't work

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
yoshimoncho
Posts: 1
Joined: Fri Mar 14, 2014 4:12 pm

functions \author{} and \title{} don't work

Post by yoshimoncho »

2 days ago I installed Latex and I ve been reading how to use it.
This is my document:

Code: Select all

\documentclass{article}


\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\author{JCPK}
\title{Electro magnetismo}
\begin{document}

$$\vec E = \int dE = \frac{1}{4\pi\epsilon_0}\int \frac{dq}{r²}  \vec r_u$$ \\
$\vec {B}$ producido por una corriente en un alambre largo y recto: \\
Idl = Idx \\
$$r^{2} = R^{2}+ x^2{2}$$ \\
$$ I\vec{dx}x \vec{r} = Idx\sin{\theta}$$ \\
$$ \sin{\theta} = \frac {R}{\sqrt {R^{2}+x^{2}}}$$ \\
$$ dB = \frac{\epsilon_0}{4\pi} \frac{Idx\sin{\theta}}{x^{2}+R^{2}}$$
Demostraci\'on.... \\
$$\vec{B_p} = \frac{\mu_0 I}{2 \pi R}$$ \\
El campo magn\'etico producido por una espira circular\\
$I \vec{dl}$ y $\vec{r} $ son perpendiculares \\
$ ||db|| = \frac{\mu_0 Idl \sin{{\theta}}}{4 \pi r^{2}} = \frac{\mu_0 Idl}{4 \pi r^{2}} $ \\
$dB_x = dB \cos{\theta} $ \\
$dB_ {perp} = dB \sin{\theta} $ este se anula por simetr\'ia
\end {document}

My problem is that the author and title don't appear in my document.
¿Could you tell me why?
Last edited by cgnieder on Fri Mar 14, 2014 6:59 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.

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

functions \author{} and \title{} don't work

Post by cgnieder »

Hi and welcome to the LaTeX community!

You need to call \maketitle after \begin{document}.

A few further remarks: you may want to add

Code: Select all

\usepackage[spanish]{babel}
to your preamble in order to get proper hyphenation and localization of strings like the date etc.

Also please note that $$ ... $$ is plain TeX syntax and should be avoided in LaTeX. (for example it creates inconsistent spacing around displayed equations...). There are a number of alternatives provided by the amsmath package that you're loading already. Maybe you want to have a look at mathtools. This doument gives a good overview over many of the math environments...

Also it is considered bad practice to add line breaks (\\) manually. Part of why LaTeX is so successful is its line-breaking algorithm. It breaks the lines by itself and usually does a very good job. Just remove all the \\ in your code. (Then also the warnings about underfull \hboxes will go away...) If you want to start a new paragraph just leave an empty line in your code.

Here is a suggestion:

Code: Select all

\documentclass{article}
\usepackage[spanish]{babel}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\usepackage{mathtools}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}

\author{JCPK}
\title{Electro magnetismo}

\begin{document}

\maketitle

\[
  \vec E = \int dE = \frac{1}{4\pi\epsilon_0}\int \frac{dq}{r^2}  \vec r_u
\]

$\vec {B}$ producido por una corriente en un alambre largo y recto:
$Idl = Idx$.

\begin{align*}
  r^{2} &= R^{2}+ x^2 \\
  I d\vec{x} x \vec{r} &= I dx\sin\theta \\
  \sin\theta &= \frac {R}{\sqrt {R^{2}+x^{2}}} \\
  dB &= \frac{\epsilon_0}{4\pi} \frac{I dx \sin\theta}{x^{2}+R^{2}}
\end{align*}
Demostraci\'on \ldots
\[ \vec{B_p} = \frac{\mu_0 I}{2 \pi R} \]
El campo magn\'etico producido por una espira circular $I \vec{dl}$ y
$\vec{r}$ son perpendiculares
\begin{align*}
  \norm{db} &= \frac{\mu_0 I dl \sin\theta}{4 \pi r^{2}} \\
         &= \frac{\mu_0 I dl}{4 \pi r^{2}} \\
  dB_x &= dB \cos{\theta} \\
  dB_{\text{perp}} &= dB \sin\theta \quad\text{este se anula por simetr\'ia}
\end{align*}

\end {document}
Regards
site moderator & package author
Post Reply