Documente Academic
Documente Profesional
Documente Cultură
25 de noviembre de 2015
Recursos
Referencias:
LATEX User Guide & Reference Manual por Leslie Lamport (Segunda
edicion, Addison-Wesley, 1994).
The LYX Users Guide por LYX Team (Version 1.6x, 28 de Abril,
2010).
1 Introduccion
2 Un primer documento LATEX
3 Modo matematico
4 Documentos complejos
5 Figuras, tablas, etc...
6 Instalacion
7 LATEXcomo word, LYX
8 Uso de plantillas
Pros
Es bueno para escribir expresiones matematicas
Excelente para documentos complejos referencias cruzadas,
etiquetado, bibliografias...
La salida de LATEX es hermosa virtualmente de calidad editorial
profesional
El systema LATEX basico es LIBRE, as como muchos editores.
LATEX hace que la escritura sea facil:
el formato es automatico
da enfasis en el contenido sobre el formato
LATEX es escrito como un texto plano
compacto y portable
transferible a traves del internet/email
puede ser editado en diferentes sistemas operativos sin perder calidad
aceptado por la mayora de los mejores editoriales academicas
hace rapido el proceso de edicion
reduce las posibilidades de error de impresion
Hilda Quispe Introduccion a LATEX 25 de noviembre de 2015 4 / 70
Introduccion
Contras
Donde conseguirlo?
Que es TEX?
Escribiendo en LATEX
TeX|(TeX)
>
COMPILAR Z
Z
Z
Z
~
Z
EDITAR IMPRIMIR Vista+Imprimir
Z
}
Z >
Z
Z ?
Z
VISTA PRELIMINAR
View|(View)
\documentclass{article}
% **** PREAMBULO ****
% ttulo/autor/fecha informacion
% definiciones, atajos, macros etc. PERO NO texto
\begin{document}
% **** CUERPO DEL DOCUMENTO ****
% ...el texto mismo
% pueden ir los CARACTERES RESERVADOS:
% \ % $ ^ _ & # ~ { }
\end{document}
Document class
\documentclass[options]{style}
style: book
report
article
letter
beamer para presentaciones
options: 11pt
12pt
a4paper
\chapter
\section
\subsection
\subsubsection
ejemplo: \chapter{ttulo}
\addtolength{\topmargin}{-5mm}
Font size
\small
\normalsize
\large \Large \LARGE \huge \Huge
Ejemplo: {\Large this will be large}
Estilo de letra
Negrita: \bf
ejemplo: {\bf esto estara en negrita}
esto esta en negrita
Italica: \it
hay varios comandos que usualmente logran el mismo resultado:
{\em italic} \textit{italic} \emph{italic} {\it italic}
producira: italic
Listas numeradas
Para una lista numerada:
\begin{enumerate}
\item Este es el primer item
\item aqui el segundo item
\begin{enumerate}
\item esto es la parte 1 del item 2
\item esto es la parte 2 del item 2
\end{enumerate}
\end{enumerate}
Escribir en espanol
Modificacion de la numeracion
Los valores de algunos comandos son por defecto en ingles. Con babel se
cambian automaticamente a valores en espanol.
Generacion de ttulos
Para construir la pagina del ttulo LATEX tiene la siguiente estructura
colocada en el preambulo.
\title{Ttulo} ttulo del documento.
\author{autor1 \and autor2 \and autor3} nombre de los
autores.
\date{fecha} puede ser fecha, \today (hoy) o dejar vacio.
\thanks{agradecimientos} produce una nota al pie con
agredecimientos o comentarios.
Finalmente colocamos \maketitle en el cuerpo del documento al
comienzo.
Otra opcion es usar:
\begin{titlepage}
texto diverso
\end{titlepage}
Hilda Quispe Introduccion a LATEX 25 de noviembre de 2015 30 / 70
Modo matematico
Modo matematico
Matematica es costosa:
\[ \] or $$ $$ muestra la formula
\( \) or $ $ formula en texto
E.g.
obteniendo:
Puedo poner x = y + 2z + 3w en el texto o como una ecuacion mostrada
en una lnea aparte:
x = y + 2z + 3w
Subscript/superscripts:
x 2y $x^{2y}$
2
x1y $x_1^{y^{2}}$
\[
\int_0^\infty f(t) \, dt
\]
La salida de lo anterior:
Z
f (t) dt
0
Letras Griegas
Ecuaciones numeradas
\begin{equation}
S_2 = \sum_{i=1}^N x_i^2 +
\sum_{i=1}^N (y_i-\overline{y})^2
\end{equation}
Ecuaciones NO numeradas
\begin{equation*}
S_2 = \sum_{i=1}^N x_i^2 +
\sum_{i=1}^N (y_i-\overline{y})^2
\end{equation*}
Resultando:
N
X N
X
S2 = xi2 + (yi y )2
i=1 i=1
Fracciones
y + z/2
x=
y2 + 1
\[
x= \frac{y+z/2}{y^2+1}
\]
Se considera una mala practica colocar \frac en las formulas dentro del
texto debido a que basicamente se ve mal: x = yy+z/2
2 +1 .
\[
\left\{ \left[\frac{1}{2}\right] -
\left[\frac{1}{4}\right] \right\}
\]
Espaciamiento
xx x x x
es producido por:
\[
x \, x \; x \quad x \qquad x
\]
Arrays
y si y > 0
x=
z +y otro modo
\[
x= \left\{
\begin{array}{cl}
y \quad & \mbox{si $y>0$} \\
z+y \quad & \mbox{otro modo}
\end{array}
\right.
\]
Alineando en columnas
se tiene:
t + (u)x + (v )y = 0,
1
ut + uux + vuy + px = 0,
1
vt + uvx + vvy + py = 0.
\begin{align*}
\rho_t + (\rho u)_x + (\rho v)_y &= 0,\\
u_t + uu_x + vu_y + \frac{1}{\rho} p_x &= 0,\\
v_t + uv_x + vv_y + \frac{1}{\rho} p_y &= 0.
\end{align*}
Numeracion de lneas
Use \begin{align} para enumerar las ecuaciones puede suprimir la
numeracion individual de una ecuacion mediante el uso del comando
\nonumber antes de \\.
t + (u)x + (v )y = 0, (2)
1
ut + uux + vuy + px = 0,
1
vt + uvx + vvy + py = 0. (3)
\begin{align}
\rho_t + (\rho u)_x + (\rho v)_y &= 0,\\
u_t + uu_x + vu_y + \frac{1}{\rho} p_x &= 0,\nonumber\\
v_t + uv_x + vv_y + \frac{1}{\rho} p_y &= 0.
\end{align}
Matrices
1 3
.. . . ..
P= . . .
1 3
se produce por:
\end{array}ccc}
1 & \cdots & 3\\
\vdots &\ddots & \vdots\\
1 & \cdots & 3
\end{array}\right)\]
Comandos/Funciones:
0
Ahorrese tiempo con \newcommand en el preamble:
\newcommand{\myint}{\int_0^\infty}
Argumentos Multiples
Usted puede dar argumentos a \newcommand:
Por ejemplo. si queremos escribir:
x2 + a
b
donde los valores de a y b pueden cambiar,
\newcommand{\myfrac}[2]{\frac{x^2+#1}{#2}}
Entonces usamos
\[
y=\myfrac{2}{4}
\]
para producir
x2 + 2
y=
4
Hilda Quispe Introduccion a LATEX 25 de noviembre de 2015 44 / 70
Modo matematico Nuevos comandos
Nuevos ambientes
En la exposicion de motivos :
Entonces en el cuerpo:
\begin{proof}
Empecemos por considerar si hay algo que probar.
Nos conduce a que no.
\end{proof}
da:
Prueba. Empecemos por considerar si hay algo que probar. Nos conduce
a que no.
Theorems
In preamble:
\newtheorem{theorem}{Theorem}[section]
\newtheorem{conj}[theorem]{Conjecture}
Then in body:
\begin{theorem}[Something] something \end{theorem}
\begin{conj}[Something else] something else \end{conj}
gives:
Theorem (Something)
something
Exercise 2
http://www2.imperial.ac.uk/~ejm/
LaTeX/Website/exercises/exercise2.html
Tables:
Statistic
Distribution Expected value Variance
Binomial(n, p) np np(1 p)
Uniform(, ) ( + )/2 ( )2 /12
Exponential() 1/ 1/2
Cuadro : Means and variances
Table code
The code:
\renewcommand{\arraystretch}{1.4}
\begin{table}[h]
\begin{center}
\begin{tabular}{|l|c|c|} \hline
& \multicolumn{2}{|c|}{Statistic} \\ \hline
Distribution & Expected value & Variance \\ \hline\hline
Binomial($n,p$) & $np$ & $np(1-p)$ \\ \hline
Uniform($\alpha, \beta$) & $(\beta+\alpha)/2$ &
$(\beta-\alpha)^2/12$ \\ \hline
Exponential($\lambda$) & $1/\lambda$ &
$1/\lambda^2$ \\ \hline
\end{tabular}
\end{center}
\caption{Means and variances}
\end{table}
Can have a fixed width box as one of the columns (to allow line breaks):
\begin{tabular}{|l|p{5cm}|} \hline
First & extremely clear and accurate
description of the school, the role in the
classroom and the teaching methods used \\ \hline
Upper Second & clear and accurate description
of the school, the role in the
classroom and the teaching methods used \\ \hline
Lower Second & a description of the school,
the role in the classroom and the
teaching methods used \\ \hline
\end{tabular}
The table
Multirow
\begin{tabular}{r@{.}l}
2&1\\
16&2\\
2&456\\
\end{tabular}
2.1
gives: 16.2
2.456
Figures
Code
\usepackage{graphicx}
\begin{figure}[h]
\begin{center}
\includegraphics[height=4cm,width=6cm]{Rplots.pdf}
\caption{Random figure}
\end{center}
\end{figure}
To rotate figures and tables use the rotating package: include the
following line in the preamble:
\usepackage{rotating}
Exercise 3
1 Pick a random picture from the web and put it in your document.
2 Tables:
http://www2.imperial.ac.uk/~ejm/LaTeX/
Website/exercises/table.html
Title
\maketitle
Contents etc...
\tableofcontents
\listoftables
\listoffigures
Numbers
Output
x = y2 (4)
In equation (4) in subsection 3 on page 61 we discussed....
The bibliography
References will only appear if they are cited in the current document.
A BibTEX file
@Book{Daub,
author={Ingrid Daubechies},
title={Ten Lectures on Wavelets},
publisher={SIAM Press},
year={1992},
address={Philadelphia, USA}
}
Entry types
See e.g.
http://en.wikipedia.org/wiki/BibTeX
\bibliographystyle{plain}
\bibliography{name}
Compiling
To change numbering
\setcounter{section}{5}
\addtocounter{section}{-2}
\setcounter{page}{7}
\arabic{page}
\roman{page}
\Roman{page}
\alph{page}
\Alph{page}
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\thesection-\Alph{subsection}}
\input{chap1}
\input{chap2}
\input{chap3}
If you only want to print part of the document, use \include, e.g. to only
print chapters 2 and 3:
\includeonly{chap2,chap3}
\documentclass{article}
\begin{document}
\include{chap1}
\include{chap2}
\include{chap3}
\end{document}
Exercise 3
http://www2.imperial.ac.uk/~ejm/LaTeX/
Website/exercises/exercise3.html