Anda di halaman 1dari 7

Latex: Some General Tips

Carlos A. Cinquetti State University of S o Paulo a Department of Economics Ricardo Goncalves Silva SERASA Modelagem Econom trica de Cr dito e e

1 Latex Editor
Miktex already help you a lot with all those Latex code and norms impossible to keep on mind, but Winedt helps with even more: automatically generate all codes you need by simply clicking within the related topic in its menu.

2 Bibliography
One main pro in using writing articles in Latex are the bibliography resources of its bibtex. Yet, for doing so you will face a not small number of challenges. Below are some tips for some common ones.

2.1 Your Bibtex File


It is like a common Tex le, though you should save it as a bibTex les with the extension .bib, instead of a tex le. Winedt automatically generates the main entrance, which are quite large, or any sort of bibliography item: articles, books, chapters in books, reports, and so on. Below is an example of a chapter in a collection: @INCOLLECTION{rod:rod, AUTHOR = "Fernando Rodrguez and Danny Rodrik", TITLE = "Trade policy and economic growth: a skeptics guide to the cross-national BOOKTITLE = "Macroeconomics Annual 2000", PUBLISHER = "The MIT Press for NBER", YEAR = "2001", editor = "B. Bernanke and K. Rogoff", pages = "143-178", address = "Cambridge, MA",} 1

You must also be advised as to the way of executing both les. It recommended to execute your latex twice after having made important changes on it. The same rule may apply to your bib le, when you click in the box g of your Winedt. However, you should not do with in the normal sequence to produce your pdf or dvi le. Rather execute latex once or twice, then the bibtex, then latex again, and lastly the dvi to pdf routine.

2.2 References and Citations


Having more than two authors, make: AUTHOR = "David Currie and Paul Levine and Joseph Pearlman, and Michael Chui", For authors having twice or more works in the same year, you must write their identication with some extension for their ordering, as well as place them within brackets as below: @ARTICLE{[har94a], } @ARTICLE{[har94b], } Their citation in the text will appear as (Harrison, 1994a) and Harrison (1994b). Regarding citations, sometimes we want the work cited outside parenthesis, others within parenthesis, and nally others as see ... Finally, sometimes will also want to refer to an specic page or chapters. The routes for each of this forms are: \cite{[har94a]} \cite[]{[har94a]} \cite[p.31]{[har94a]} \cite[see][ch. 2]{green}

In the case of articles or books by more than two authors, Latex automatically generates (authora et al.). However, if you wish that all names show you must do: \cite*[]{currie:et} and it will apper as (Currie, Levine, Pearlman, and Chui).

2.3 References Style


You can also make some special style. For instance, if your document is double spaced and you do not want the same for your bibliography, except bib item, then your entry for references should be: \singlespacing \bibliography{bib file} \appendix Notice that, in this case, you extend this style to the appendix as well. 2

2.4 Brazilian References


There are to problems to solve: how to substitute article and for e, if your are writing in portuguese, and how to build your reference in the Brazilian style. In your preamble, choose the harvard style in your menu, that is, specify this package: \bibliographystyle{harvard} Then, build your references as: \begin{thebibliography} \end{thebibliography} Take care of specifying the [Brazil, brazilian]babel in your menu. Then you insert which item of your bibliography in the latex le as the example below: \harvarditem{Brander e Krugman}{1983}{brander:krugman} Brander, James A. e Paul R. Krugman. A "Reciprocal Dumping" Model of International Trade. {\it{Journal of International Economics}}, 15, 313-323.1983. The three rst entries are the only properly Latex codes; the remaining ones are a normal text, which you edit according to the journal style. Explaining better the three rst entries \harvarditem{authors as cited}{date}{label}

3 Tables
3.1 Creating Tables
Creating Tables is awfully tiresome. There is, though, a package that automatically converts Excels Tables into the Latex language. It is called Excel2Latex. After creating your table in the Microsoft Excel, you should execute your Excel2Latex. Your Latex will automatically open an option in the Tools menu, called convert to Latex. Click there and follow it through. Before you have to select, with your mouse, the desired table, which is the only thing Excel2Latex will convert. All these does not spare you from knowing the basic language for tables in Latex, which will enable you making extra ne edition. By the way, notice that your Tabular environment will have to be placed within the Table environment.

3.2 Placing Tables


Since the convention is having a Table just after mentioning it, gives the command [hb!], or simply [hb], meaning here bottom, as in the above example. You can also try [h!] or [h] if your Table is placed too far below in the text. We also found out that using the threeparttable helped to having the Tables more correctly placed into your document. In this case, will have to write the \usepackage{threeparttable} in the preamble. 3

3.3 Dimensions
Sometimes your Table takes a too wide or narrow space of your text. One way to overcome it is editing Tables with smaller letter, using the scalefont command: \begin{table}[h!]\scalefont{0.9} \setlength{\tabcolsep}{1.3pt} You can also edit the columns wideness, using the setlenght environment, as in the above example. A corresponding command will be required in your preamble. You can go up to 12pt or more, as well as below 1pt.

4 Numbering Equations, Figures and Table


Unless you place the label of your with the caption for the Table, your latex will confuse all Table, Figure, and equations numbering. That is, if you have a Table between two equations, the latter one will be incorrectly numbered in the paragaphs, when referring to them. Accordingly, the whole writting of your Table will have the following format:

\begin{table}[hb!] \begin{threeparttable}\caption{Table name \label{tabshortname}} \begin{tabular} \end{tabular} \end{threeparttable} \end{table}

5 Figures and Graphs


5.1 Placing Figures
As with the Table environment, you will have to create an environment for them, as below: \begin{figure}[ht] \centering \caption{nickname \label{fig..} \includegraphics[width=12cm]{C:/drive/fig1.eps}\\ \end{figure}

The above illustrate a gure transformed to a eps form, store in an specic drive of your computer, as well as the instruction for your Latex to capture it. wrapgure Floating text around gures. \begin{wrapfigure}[6]{o}{10cm} \centering \includegraphics[angle=-90, 4

width=\linewidth]{C:/DATA/figtarlev.eps} \caption{Effective Rate of Protection \label{tarfig}} \end{wrapfigure} It requires the %usepackagewrapf ig. Floatt E similar ao wrapgure, permitindo um detalhamento maior, como a inclus o de nome da a gura. E necess rio no pre mbulo colocar a a %usepackage[rt]oatt ` Onde o argumento opcional rt indica que os gr cos ser o colocados a direita do texto. a a ` Com lt seriam colocados a esquerda e vt indica que o gr co sair a direita nas p ginas ima a` a pares e a esquerda em p ginas mpares. a Exemplo Este ambiente... Reducing the space between gure and the text. In order to make the the command vspace works better, together with the setting of [H] instead of [h!], one should load usepackagef loat \begin{figure}[H] \begin{center} \caption{Effective Rate of Protection \label{tarfig}} \includegraphics[angle=-90, width=\linewidth, totalheight=12cm]{C:/DATA/figtarlev.eps} \end{center} \end{figure} \vspace*{-4cm} Notice the use of the environment center as well as the parameter totalheight within the includegraphics.

5.2 Creating Graphs


Except for those numerical or functional graphs generated in Matlab, or related softwared, you can draw your graphes in the software TEXCAD, by Gautier de Montmollin, and send it to Latex. Steps. Generate, rst, your theoretical gure in the TEXCAD and save it. Secondly, open the les in Wordpad. An incredible large written le will show up, which correspond to the Latex command for each line, curve and special treats. Third, copy all this text and paste it within your Figure command. As with the Excel2Latex, knowing the basic language command is advisable; it will enable you further editing, as well as more correct placing of some lines. Special command for the gures in the preamble will be necessary for having it nicely edited or placed.

6 Subsections Without Number


It is an option having your subsections numbered or not. If you prefer to not number them do: \subsection*{All Test} 5

7 Spacing and Numbering


7.1 Avoiding Page Numbering and Date
Just type \pagenumbering{} where line spacing is due. When executing Latex, a error sort message will show up; just type enter and go on. An alike command must be typed in your title if you do not want to exhibit the data your document was created: \title{Economic Policy} \vspace{1.5cm} \date{} \maketitle

7.2 Space in itemize, enumerate and drescription


The below, to be re-edited, I copied from Jacob .... in the internet. Adjusting spacings etc. in itemize, enumerate and description environments. The standard listmaking environments are dened as special versions of the list environment. The list environment contains a large number of adjustable parameters, setting the margins, spacing between items etc. etc. Some of these, such as %itemsep can be set immediately after the %begin command: Others, such as %topsep, cannot be adjusted in this way as it is used inside the %begin statement. Anyway, in the spirit of LaTeX these spacings should be adjustable in a global way. Solution: The tweaklist.sty package redenes the itemize, enumerate and description packages, so that all parameters can be adjusted. This was done by copying the original denitions, and adding hook commands that are executed when entering the environment. The hook commands are initially empty, but can be redened with %renewcommand. Example: to set %topsep and %itemsep to 0 in the enumerate environment, use: %usepackagetweaklist %renewcommand%enumhook%setlength%topsep0pt The following hook commands are dened: enumhook for the enumerate environment, itemhook for the itemize environment, and descripthook for the description environment. LaTeX keeps track of nested enumerate and itemize environments. If you only want to modify a specic nesting level, you should not use enumhook or itemhook. Special hooks are dened that are only called at the specic level. For the enumerate environment they are enumhooki, enumhookii, enumhookiii, and enumhookiv. For the itemize environment they are itemhooki, itemhookii, itemhookiii, and itemhookiv. The level-specic hooks are called after the global hook, so they can redene a setting in the global hook. As LaTeX does not keep track of the nesting level of description environments, there are no level-specic hooks for that environment. 7.3 Adding and removing horizontal spaces From an author in the internet Adding/Removing Space: %hspacelen Make len horizontal space. NOTE: len can be negative \hfill 6

\hrulefill Fills the current line with space. With \hrulefill, the space is underlined. Example: If you want to create a form that says Name: __________, where the underline is 3 inches long, use this: Name: \makebox[3in]{\hrulefill} \vspace{len} Leave len vertical space.

8 Special Styles
8.1 Underlines

When working with a coauthors, you may wish to underline some changes made. The same might occur when submitting your paper to a reviewer. Latex has its underlines environment, but it works poorly, for the whole phrase will appear in a unique line. The a good alternative is introducing \usepackage{ulem} and then select the phrase with \emph{here is the phrase underlined}

Anda mungkin juga menyukai