Вы находитесь на странице: 1из 67

TUTORIAL DE LATEX

M. en C. Erika Vilches

TEX Y LATEX
TeX

es un programa de computadora para hacer composicin tipogrca de documentos.


Creado Toma

por D. E. Knuth

un archivo preparado adecuadamente y lo convierte en una forma que puede ser impresa en muchos tipos de impresoras (Laser, mqunas de composicin tipogrca de alta resolucin,etc.) editoriales utilizan TeX para hacer la composicin tipogrca de libros y revistas matemticas.

Muchas

Documentos

simples que no contienen frmulas matemticas o tablas pueden ser producidos muy fcilmente
El

cuerpo del texto es escrito prcticamente sin alteraciones Observando ciertas reglas con respecto a las comillas y signos de puntuacin. composicin tipogrca matemtica es ms complicado

Hacer LaTeX

Escrito Uno

por L. B. Lamport

de los dialectos de TeX adecuado para la escritura de libros y artculos

Particularmente

largos

Tiene facilidades para la numeracin automtica de captulos, secciones, teoremas, ecuaciones, etc. Asimismo, tiene facilidades para hacer referencias. Es una coleccin de macros de TeX diseada para facilitar la tarea del escritor en la creacin de documentos.

HELLO WORLD EN TEX


Crear

un archivo llamado hello.tex y escribir lo siguiente en l:

Hello \TeX\ world! \bye

Lo

que produce:

Nota:

TeX es case-sensitive

El

compilador de TeX produce un archivo *.dvi (devide independent) llamado hello.dvi archivo hello.dvi es posteriormente convertido a postscript hello.ps
Podemos

El

verlo en postcript con programas como GSView o convertirlo a PDF.

HELLO WORLD EN LATEX


Crear

un archivo llamado hello.tex y escribir lo siguiente en l:

\documentclass{article} \begin{document} Hello \LaTeX\ world! \end{document}

Lo

que produce:

Nota:

LaTeX es case-sensitive

ESPACIOS Y PRRAFOS
TeX

y LaTeX ignoran los espacios y nuevas lneas. en TeX:

Ejemplo

Hello \TeX\ World! \bye

Produce:

Es

necesario colocar una lnea en blanco entre prrafos para producir un nuevo prrafo.
Now is the time for all good men to come to the aid of their country. Now is the time for all good men to come to the aid of their country. \bye

CAMBIANDO LA FUENTE
Las

siguientes opciones estn disponibles: roman

\rm \br \it \sl \tt

bold

italica slanted typewriter script

\cal

Ejemplo:
If you change to \it italic \rm you must remember to change back to roman. If you change to \bf boldface and forget to change back to roman, all of your remaining text will be boldface. \bye

Agrupar

mediante llaves limita el alcance del tipo de letra.

\rm Grouping with curly braces limits the scope of {\bf bold typeface}. This is the most {\it efficient} way to change typefaces. \bye

CARACTERES ESPECIALES
TeX \ { }

y LaTeX reservan caracteres especiales para distintos usos importantes. Smbolos especiales e instrucciones literal $\backslash$ Abrir un grupo literal $\{$ Cerrar un grupo literal $\}$ Comentarios literal \% Alineaciones de tablas y Tabs literal \&

% &

Espacio no partible literal \{}

$ _ #

Empezar o terminar texto matemtico literal \$ Superscripts matemticos literal \{} Subscripts matemticos literal \_{} Denir smbolos de reemplazo \#

%This is a comment Almost 100\% of the \$300 is {\bf gone}! If $x_1^2-2x_1=3$, then find the value of $x_1$ and use this result in exercise \#1. \bye

MATEMTICAS EN TEX
Las

expresiones matemticas inline se encierran en $ ... $ matemticas utilizamos $$ ..... $$

Para desplegar expresiones

If $f$ is continuous on $[a,b]$, differentiable on $(a,b)$, then there exists a $c$ in $(a,b)$ such that $$ f'(c)={{f(b)-f(a)}\over {b-a}}. $$ \bye

No

olvidar que TeX ignora los espacios y lneas nuevas, de modo que es lo mismo escribir:
If $f$ is continuous on $[a,b]$, differentiable on $(a,b)$, then there exists a $c$ in $(a,b)$ such that $$ f'(c)={{f(b)-f(a)}\over {b-a}}. $$ \bye

Que

escribir:

If $f$ is continuous on $[a,b]$, differentiable on $(a,b)$, then there exists a $c$ in $(a,b)$ such that $$ f(c)={{f(b)-f(a)}\over {b-a}}.$$

COMILLAS Y GUIONES
Para

envolver una palabra o frase entre comillas iniciar la frase con dos comillas sencillas de apertura consecutivas y terminarla con dos comillas sencillas de cierre
``Merrily we roll along'' cried the Mad Hatter. \bye

Existen

varios tipos de guiones en LaTeX, cada uno con un propsito distinto.

My mother-in-law did exercises 11--22 in her workbook ---a thoroughly difficult assignment--while it was $-20$ degrees outside. \bye

ESTRUCTURA DE UN DOCUMENTO LATEX

ELEMENTOS DE UN BUEN ARTCULO


Titulo Autor Fecha Abstract Tabla

de Contenido de secciones y subsecciones

Encabezados Referencias Notas

al Pie

DECLARANDO LA CLASE DE UN DOCUMENTO


Recordando

la estructura bsica de un documento en LaTeX:

\documentclass{article} prembulo \begin{document} Escribir el cuerpo del documento aqu \end{document}


\documentclass{article}

instruye a LaTeX para que utilice la clase artculo cuando estructure el documento.

Algunas

otras clases de LaTeX son: Util para escribir un reporte, tesis, etc.

report book

Util para escribir libros Utilizado para crear cartas, memorandums, etc. Utilizado para crear diapositivas

letter slides

CREANDO EL TTULO DE UN ARTCULO


\documentclass{article} %Always place the following commands in the preamble \title{My First \LaTeX\ Article} \author{Erika Vilches} \date{August 24, 2009} \begin{document} %But create the title in the body of the document \maketitle Place the body of your article here. \end{document}

Para

crear una pgina de ttulo separada, utilizar la opcin titlepage en la declaracin de la clase. Ej:
\documentclass[titlepage]{article} %Always place the following commands in the preamble \title{My First \LaTeX\ Article} \author{Erika Vilches} \date{August 24, 2009} \begin{document} %But create the title in the body of the document \maketitle Place the body of your article here. \end{document}

Pgina 1

Pgina 2

CREANDO UN ABSTRACT
\documentclass{article} \title{My First \LaTeX\ Article} \author{Erika Vilches} \date{August 24, 2009} \begin{document} \maketitle %The abstract goes here \begin{abstract} An abstract is one of the most important parts of your article. Readers use the abstract to determine if they want to read further, so you have to hook them in with a good abstract. \end{abstract} Place the body of your article here. \end{document}

El

resultado es:

Agregando

algo de cuerpo:

\documentclass{article} \title{My First \LaTeX\ Article} \author{Erika Vilches} \date{August 24, 2009} \begin{document} \maketitle \begin{abstract} An abstract is one of the most important parts of your article. Readers use the abstract to determine if they want to read further, so you have to hook them in with a good abstract. \end{abstract} This time we want to place something significant in the body of our document. After you are done, use copy and paste to follow this paragraph with about 50 copies of itself. Remember to separate paragraphs in the source with at least one blank line. \end{document}

Resultado:

SECCIONES Y SUBSECCIONES
Utilice

\section para obtener encabezados de seccin automticamente numerados.


\section{Type Whatever You Want Here} This time we want to place something significant in the body of our document. After you are done, use copy and paste to follow this paragraph with about 50 copies of itself. Remember to separate paragraphs in the source with at least one blank line.

Las

subseccions se crean utilizando el comando \subsection

\subsection{Type Whatever You Want Here} This time we want to place something significant in the body of our document.

Para

crear secciones y subsecciones sin numeracin utilizar \section* y \subsection*

\section*{Hello}

TABLA DE CONTENIDO

Para Es

aadir la tabla de contenido se utiliza el comando \tableofcontents justamente despus del abstract. necesario correr LaTeX sobre el documento dos veces antes de poder ver el resultado. formas con asterisco de seccion y subseccin no sern mostradas en la tabla de contenido.

Nota: Las

\documentclass{article} \title{My First \LaTeX\ Article} \author{Erika Vilches} \date{August 24, 2009} \begin{document} \maketitle \begin{abstract} An abstract is one of the most important parts of your article. Readers use the abstract to determine if they want to read further, so you have to hook them in with a good abstract. \end{abstract} \tableofcontents \section{Type Whatever You Want Here} This time we want to place something significant ...

El

contador secnumdepth controla qu encabezados sern numerados


Para

numerar solamente encabezados de primer nivel (encabezados \section), utilice en el prembulo el comando:

\setcounter{secnumdepth}{1}

Para

que los cambios tengan efecto, deber ejecutarse dos veces el comando LaTeX

El

mismo modo, el comando:

\setcounter{secnumdepth}{2}

Numerara

los primeros dos niveles de encabezados (\section y \subsection)

Colocar:
\setcounter{tocdepth}{1}

en el prembulo permitir solamente encabezados de nivel 1 (\section) en la tabla de contenido

BIBLIOGRAFA
Es

creada con el ambiente.

\begin{thebibliography}{sample.label} entries \end{thebibliography}

Las

entradas individuales en la bibliografa comienzan cada una con el comando (la etiqueta es opcional, la llave no):
\bibitem[label]{key} entry.text

Ejemplo: Al

nal de su documento, antes del comando \end{document}, agregue lo siguiente:

\begin{thebibliography}{03} \bibitem{erika} Erika, \emph{Data Mining} \end{thebibliography}

Note

que no se proporciono ninguna etiqueta, de modo que los elementos de la bibliografa se numerarn automticamente, comenzando con el nmero 1.

Referenciando Una

la bibliografa:

cita en el cuerpo del documento es hecha con el siguiente comando:

\cite{key}

Por

ejemplo, colocando en el cuerpo de nuestro documento:

\cite{erika}

Si

no se desea numeracin automtica, se puede utilizar la etiqueta opcional del comando \bibitem para crear etiquetas propias.

Ejemplo:
\begin{thebibliography}{Erika, 2003} \bibitem[Erika, 2003]{erika} Erika, \emph{Data Mining} \end{thebibliography}

NOTAS AL PIE
LaTeX

provee notas al pie auto-numeradas.

Ejemplo:
In the first place,\footnote{What happens to second place?} I dont want to hear about it!

Esto Si

pone una nota al pie inmediatamente despus de la palabra que referencia la nota referencia un enunciado o frase, ponerla despus del punto.

LISTAS ENUMERADAS
\begin{enumerate} \item Put on the paper. \item Put on the tape. \item Put on the ribbon. \end{enumerate}

Se

pueden anidar hasta 4 niveles

\begin{enumerate} \item If $f(x)=x2-2x-3$, then $f(2)$ equals \begin{enumerate} \item $-3$ \item $2$ \item $-9$ \item $12$ \item None of these \end{enumerate} \item What is the formula for the area of a circle? \end{enumerate}

LISTAS DE VIETAS
\begin{itemize} \item Put on the paper. \item Put on the tape. \item Put on the ribbon. \end{itemize}

Se

pueden anidar hasta 4 niveles

\begin{itemize} \item The graph of $x=\cos3 t$, $y=\sin3 t$ is symmetric with respect to \begin{itemize} \item the $x$-axis, \item the $y$-axis, and \item the origin. \end{itemize} \item Parametric equations are fun! \end{itemize}

LISTAS DESCRIPTIVAS
Tienen

forma de glosario.

\begin{description} \item[elephant] A large mammal with a long snout and ivory tusks, usually found in Africa. \item[skunk] A foul smelling animal, all black with a white stripe down its back and tail, usually encountered by Don Hickethier on his morning ride to work. \item[golf swing] Something Todd is working on! \end{description}

Se

pueden anidar hasta 4 niveles

\begin{itemize} \item The graph of $x=\cos3 t$, $y=\sin3 t$ is symmetric with respect to \begin{itemize} \item the $x$-axis, \item the $y$-axis, and \item the origin. \end{itemize} \item Parametric equations are fun! \end{itemize}

TABLAS
\begin{tabular}{ll} \textbf{Name} & \textbf{Address} \\ David Arnold & 1223 My Blue Heaven \\ Mike Butler & 666 Devils Highway \\ Todd Olsen & 1234 Sand Trap \\ \end{tabular}

El El Si

& es utilizado para separar entradas en una la \\ indica el nal de una la se deseara justicar a la derecha la columna Address

\begin{tabular}{lr} \textbf{Name} & \textbf{Address} \\ David Arnold & 1223 My Blue Heaven \\ Mike Butler & 666 Devils Highway \\ Todd Olsen & 1234 Sand Trap \\ \end{tabular}

Es

posible centrar cada columna y poner una lnea horizontal debajo de la primera la:
\begin{tabular}{cc} \textbf{Name} & \textbf{Address} \\ \hline David Arnold & 1223 My Blue Heaven \\ Mike Butler & 666 Devils Highway \\ Todd Olsen & 1234 Sand Trap \\ \end{tabular}

Es

posible separar columnas con lneas verticales y las con lneas horizontales.

\begin{tabular}{|c|c|} \hline \textbf{Name} & \textbf{Address} \\ \hline David Arnold & 1223 My Blue Heaven \\ \hline Mike Butler & 666 Devils Highway \\ \hline Todd Olsen & 1234 Sand Trap \\ \hline \end{tabular}

Para

centrar la tabla completa en la hoja, insertarla en un ambiente de centrado:


\begin{center} \begin{tabular}{|c|c|} \hline \textbf{Name} & \textbf{Address} \\ \hline David Arnold & 1223 My Blue Heaven \\ \hline Mike Butler & 666 Devils Highway \\ \hline Todd Olsen & 1234 Sand Trap \\ \hline \end{tabular} \end{center}

\begin{enumerate} \item If $x3-2x2-3x-11$ is divided by $x+1$, the remainder is\\ \begin{tabular}{lllll} a) $x-3$ & b) $x+1$ & c) $x-11$ & d) $x-2$ & e) None of these\\ \end{tabular} \item What is the formula for the area of a circle?\\ \begin{tabular}{lllll} a) $\pi r2$ & b) $2\pi r$ & c) $\pi d2$ & d) $2\pi d$ & e) None of these\\ \end{tabular} \end{enumerate}

QUOTES Y QUOTATIONS
Utilice

el ambiente de quote para hacer pequeas citas.

\begin{quote} Now is the time for all good men to come to the aid of their country. Now is the time for all good men to come to the aid of their country. \end{quote}

Utilice

el ambiente quotation para hacer citas de mayor tamao.

\begin{quotation} Now is the time for all good men to come to the aid of their country. Now is the time for all good men to come to the aid of their country. Now is the time for all good men to come to the aid of their country. Now is the time for all good men to come to the aid of their country. \end{quotation}

EL AMBIENTE VERBATIM

Para

que LaTeX respete los espacios y saltos de lnea, se utiliza el ambiente verbatim. til para pegar cdigo de computadora en el documento.

Particularmente

\begin{verbatim} while (i <= m) & (j <= n) [p,k] = max(abs(A(i:m,j))); k = k+i-1; if (p <= tol) A(i:m,j) = zeros(m-i+1,1); j = j + 1; else jb = [jb j]; A([i k],j:n) = A([k i],j:n); A(i,j:n) = A(i,j:n)/A(i,j); for k = [1:i-1 i+1:m] A(k,j:n) = A(k,j:n) - A(k,j)*A(i,j:n); end i = i + 1; j = j + 1; end end \end{verbatim}

Resultara

en:

ECUACIONES EN LNEA CONTRA INDEPENDIENTES


\documentclass{article} \begin{document} Summation notation, as in $\sum_{k=1}n 2k$, looks slightly different when it occurs within a line of text (in-line). Contrast this appearance with the display $$ \sum_{k=1}n 2k. $$ \end{document}

Las

matemticas en lnea tambin se pueden delimitar con \( ... \) y las matemticas independientes con \[ ... \]

\documentclass{article} \begin{document} Integration, as in \(f(x)=\int_1x f(t)\,dt\), looks slightly different when it occurs within a line of text. Contrast this appearance with the display \[ f(x)=\int_1x f(t)\,dt. \] \end{document}

Asimismo, es

posible delimitar las matemticas en lnea con \begin{math}. . . \end{math} y las matemticas independientes con \begin{displaymath}. . . \end{displaymath}
La

forma menos comn de hacerlo

Si

aparece ms de un caracter en un subscript o superscript, utilizar smbolos de agrupacin para contenerlos


Ejemplo:

$x_{i,j}$

Inserta un pequeo espacio entre f(t) y dt

Para

crear comandos nuevos utilizamos el comando:

\newcommand

Ej: Si

una expresin se repite muchas veces, se puede crear un comando para no escribirla reiteradamente.

\documentclass{article} \newcommand{\be}{\begin{enumerate}} \newcommand{\ee}{\end{enumerate}} \begin{document} I have to complete the following chores today. \be \item Mow the lawn. \item Rake the leaves. \item Wash the car. \ee \end{document}

Cambiando Hay

los estilos de fuente

tres familias de fuentes

\textrm Roman \textsf Sans Serif \texttt Typewriter

\documentclass{article} \begin{document} Here is a sample of the \textsf{Sans Serif} family, and here is a sample of the \texttt{Typewriter} family. \end{document}

Existen

dos series de letras.

\textmd Serie media \textbf Serie boldface

\documentclass{article} \begin{document} This is \textbf{bold}, while \textbf{this is \textmd{medium} series}. \end{document}

Existen

cuatro formas de letra:

\textup Upright \textit Italicas \textsl Slant \textsc Small caps

\documentclass{article} \begin{document} At 3\,\textsc{pm}, you can easily tell the difference between \textit{the italic font shape} and \textsl{the slant font shape}. \textit{If the text is already italic, emphasis is provided by \textup{the upright shape} in the italicized sentence}. You can also combine various text commands, as \textsl{in \textbf{this} phrase}. In most circumstances, if you want to emphasize \emph{a word or phase}, use the \verb+\emph+ command. \end{document}

Вам также может понравиться