View
267
Download
1
Category
Preview:
Citation preview
Curso de Latex
CINVESTAV-IPNEnero 2011
Que es Latex?
• Latex es un sistema genérico de tipografía que utiliza Tex como su motor de formato.
• Es un sistema de composición de textos, orientado especialmente a la creación de libros, documentos científicos y técnicos.
• Es un compendio de macros de Tex.
Ventajas de Latex
• Es gratis• Es flexible• Calidad tipográfica profesional• Esta presente en casi todas las áreas de
las ciencias y humanidades.• No es restrictivo a una arquitectura de
computadora o sistema operativo.
• En el contexto de nuestra área de trabajo, las principales editoriales científicas proveen plantillas en Látex, las cuales al utilizarlas aseguramos que cumplimos con las restricciones de la publicación.– IEEE– Elsevier
Cosas necesarias para empezar a utilizar Latex
• Tener instalado:– Miktex.– Editor de código.– Ghostscript y Ghostview .– Adobe Reader.
Procedimiento de instalación
1.- Instalar Miktex2.- Instalar Ghostscript3.- Instalar Ghostview4.- Instalar Adobe Reader5.- Instalar editor de código (se sugiere
LED)
Antes de empezar• Podemos ver a Latex como un lenguaje de
programación, el cual posee comandos, símbolos reservados, se rige por una estructura.
• Algunos de los caracteres reservados son:– $ sirve para poner ecuaciones en el texto.– \ sirve para introducir comandos– % sirve para poner comentarios– {} sirve para poner argumentos de los comandos– & en las tablas implica un salto de columna– _ ^ sirve en el ambiente de ecuaciones– ~ #
• Si se desea utilizar estos símbolos en el texto se les antepone “\” excepto para “\”, ya que “\\” significa un salto de línea
Estructura de documento en latex
• Generalmente se compone de:– Preambulo. En esta sección se pone las
librerías a utilizar y las configuraciones del documento de ser necesario.
– Cuerpo. En esta sección se pone todo lo que queremos escribir.
Clases de documentos• \documentclass[parametros]{clase de documento}• Clases de documentos
– Book– Report– Article– Letter
• Parametros– 10pt|11pt|12pt– letterpaper|legalpaper|executivepaper|a4paper|a5paper|b5paper– Landscape– final|draft– oneside|twoside– openright|openany– onecolumn|twocolumn– notitlepage|titlepage– Openbib– Leqno– fleqn
Paquetes• \usepackage[opciones]{paquete}• Paquetes importantes
– graphicx [pdftex, dvips]– amsmath– latexsym– babel [spanish]
Preámbulo de artículos de ieee• \documentclass[11pt,draftcls,onecolumn]{IEEEtran/IEEEtran}• \documentclass[9pt,twocolumn,twoside]{IEEEtran/IEEEtran}
\ifCLASSINFOpdf \usepackage[pdftex]{graphicx}\else \usepackage[dvips]{graphicx}\fi\usepackage{stfloats}\usepackage{stmaryrd}\usepackage{textcomp}\usepackage{verbatim}\usepackage{latexsym}\usepackage{bbm}\usepackage{amssymb}\usepackage{eufrak}\usepackage{amsbsy}\usepackage{multirow}\usepackage{dsfont}\usepackage[cmex10]{amsmath}\interdisplaylinepenalty=2500
Cuerpo del documento
• Siempre se comienza con:– \begin{document}
• Y se finaliza con:– \end{document}
• Dentro del cuerpo puede haber texto, ambientes (ecuaciones, tablas, imágenes, teoremas, etc)
Estructura dentro del cuerpoComando Nivel Comentario
\part -1 No en letter
\chapter 0 Solo en book y report
\section 1 No en letter
\subsection 2 No en letter
\subsubsection 3 No en letter
\paragraph 4 No en letter
\subparagraph 5 No en letter
Sintaxis: \chapter*[nom_alternativo]{nombre} el asterisco indica que no se va a numerar en el indice
Ambientes
• Los ambientes son estructuras definidas en latex los cuales nos permiten introducir en nuestro documento ecuaciones, imágenes, tablas, etc
• Su sintaxis es– \begin{ambiente}
– \end{ambiente}
Ambientes
• Principales ambientes– equation– tabular– table– figure– itemize
Ecuaciones
• Sintaxis– Si es en la misma línea donde estamos poniendo
texto, entonces se usa “$”: • bla bla bla $3x=y$ bla bla bla
– Si lo queremos poner como una ecuacion a parte del texto, entonces:
• Bla bla bla bla:\begin{equation}3x=y\end{equation}Bla bla bla bla
ecuaciones
El comando \label{etiqueta} nos permite etiquetar la ecuacion para poder hacer posterior referencia a ella en el texto mediante el uso de \ref{etiqueta}.
• Para poner:– Subindice _– Superindice ^– Negritas \mathbf, \boldsymbol– Fraccion \frac{numerador}{denominador}– Sumatoria \sum_{a}^{b}– Integral \int– Adornos \hat{}, \tilde{}
• Para mayor referencia consultar:Short math guide for latex ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf
Múltiples líneas de ecuaciones
Ecuaciones con múltiples casos
Figuras
• Latex acepta diverso formatos de figuras dependiendo del parámetro que le pasemos al paquete graphicx– Pdftex - Acepta figuras en formato pdf, png, jpg– Dvips - Acepta figuras en formato eps
• Es recomendable que utilicemos figuras vectoriales (eps o pdf) ya que no perdemos resolución.
Figura
• Se empieza definiendo un ambiente de figura \begin{figure}[]…..\end{figure}
El cual es un objeto flotante en el documento de latex, en otras palabras es un objeto que no se puede dividir en dos paginas y latex trata de ubicarlo en la mejor posición.
• Entre los corchetes podemos poner un especificador de posición:– h lo trata de poner aproximadamente en el mismo lugar donde
ocurre en el texto– t lo pone al inicio de una pagina– b lo pone al final de una pagina– p lo pone en una pagina especial para objetos flotantes– ! Ignora lo parametros del compilador que calcula la mejor posicion– H=h!
• El siguiente comando que se debe poner es:
\includegraphics[parametros]{ruta/nombre}
Donde la ruta es relativa a la carpeta donde se esta compilando y el nombre puede o no ir con la extensión de la imagen.
• scale= number; enters the number by which the figure size should be magnified over its natural size; • width= length; specifies the width to which the figure should be scaled to; if height not given, it is scaled with the
same factor as the width; • height= length; specifies the height to which the figure should be scaled to; if width is not given, it is scaled with
the same factor as the height; • totalheight= length; like height but specifies the height plus depth of the figure; should always be used in place
of height if the figure has been rotated; • keepaspectratio(= true/false); if both height and width are specified, this flag ensures that the original
height/width ratio remains unchanged; the figure will not exceed either of the given dimensions; • angle= number; the angle by which the figure is to be rotated counterclockwise, in degrees; any height or width
specifications coming before this key are also rotated, so that the height becomes the width, while the width becomes either the height (positive angle) or depth (negative angle);
• origin= loc; determines the point about which the rotation occurs; default is bl for bottom left corner; also possible are c for center, t for top, r for right, and B for baseline; any sensible combination, such as tr, is allowed;
• draft(= true/false); like the draft package option but applied to the one graphics file; the figure is not imported, but rather a framed box of the correct size is printed containing the name of the file;
• clip (= true/false); suppresses the printing of any graphic outside the bounding box; • bb= llx lly urx ury; enters the coordinates of the bounding box manually, if they are missing or incorrect in the
graphics file, or to be deliberately altered; the specifications are four lengths separated by blanks; units may be given, but if omitted, big points (bp) are assumed;
• viewport= llx lly urx ury; specifies the bounding box but relative to the lower left corner of the existing one; useful for correcting the bounding box, or (with clip) to select only a portion of the whole figure;
• trim= dllx dlly durx dury; reduces the existing bounding box by the amounts specified; • hiresbb (= true/false); like the hiresbb package option but applied to the one graphics file; reads bounding box
information from the %%HiResBoundingBox line in the graphics file.
Múltiples imágenes en una figura• Para eso debemos utilizar el paquete
– \usepackage{subfig}
\begin{figure}[!ht]\centering\subfloat[]{\label{fig5a}\includegraphics[width=1.6in]{figures/Fig5a}%}\subfloat[]{\label{fig5b}\includegraphics[width=1.6in]{figures/Fig5b}%}\hfil\subfloat[]{\label{fig5c}\includegraphics[width=1.6in]{figures/Fig5c}%}\subfloat[]{\label{fig5d}\includegraphics[width=1.6in]{figures/Fig5d}%}
\caption{The proved validity of the xGM by simulation for (a) Non-separable xPAS, (b) xSCF obtained from xPAS through $\text{xAMV}_{\text{C}}$, (c) xWNS obtained from xPAS through xGM and (d) xSCF obtained from xWNS via 2IFT.}
\label{fig5}\end{figure}
Tablas
• Es necesario crear un ambiente flotante– \begin{table}….\end{table}
• Y dentro de ese flotante se crea la tabla mediante el ambiente – \begin{tabular}…….\end{tabular}
• Es posible que se necesite incluir las librerias:– \usepackage{multirow}– \usepackage{multicolumn}
Tablas• Para cambiar de columna usamos &• Para cambiar de renglón usamos \\• Para dibujar una linea horizontal usamos
– \hline
Bibliografía• Existen 2 formas
– Escribir la bibliografía en el mismo documento– Insertar un archivo bibtex
• Forma 1– \begin{thebibliography}{99}\bibitem{papertec:1}A.~G. Orozco-Lugo, R.~Parra-Michel,
D.~McLernon, and V.~Kontorovitch, ``Enhancing the performance of the cr blind channel estimation algorithm using the Karhunen-Lo\`{e}ve expansion,'' in \emph{Proc. {IEEE} International Conference on Acustics, Speech, and Signal Processing ({ICASSP}’02)}, Orlando, USA, May 2002, pp.~III2653-III2656.
\end{thebibliography}
Bibliografía
• El 99 en el ambiente thebibliography le es para indicarle al compilador que la etiqueta mas ancha que esperamos sea del ancho del texto 99.
• Cada entrada en la bibliografía se hace utilizando el comando– \bibtem
Bibliografía
• Forma 2– En esta se le indica al compilador donde se
encuentra un archivo bibtex.– Al tener este archivo, es necesario compilarlo
primero para que nos entregue un archivo con las entradas bibtem.
• \bibliography{biblio/IEEEabrv,biblio/biblio}• Dirección relativa a la carpeta de trabajo
Bibliografía
• El compilador solo nos pondrá en la bibliografía las referencias que utilizamos en el texto.
• Podemos tener diferentes estilos de bibliografía, estos se definen de la siguiente manera:– \bibliographystyle{estilo}– donde los estilos son:
• IEEEtran• abbrv• acm• alpha• plain• siam• unsrt
• Referencia• http://en.wikibooks.org/wiki/LaTex/Bibliography_Manage
ment
Bibliografía y Links
• http://www.elsevier.com/wps/find/authorsview.authors/latex
• http://www.ieee.org/publications_standards/publications/authors/authors_journals.html
• M. Goossens, F. Mittelbach, A. Samarin, “The Latex companion”, Addison-Wesley, 1999.
Recommended