2. A
LTEXBase
Emmanuele Somma1
14 Dicembre 2007
c 2007 – Emmanuele ’exedre’ Somma
riproduzione integrale permessa con qualsiasi mezzo
1
Bank of Italy - Research Area Computer Support
E. Somma L EXBase
AT 13/12/2007 2 / 61
3. Part I
Introduzione
E. Somma L EXBase
AT 13/12/2007 3 / 61
4. e A
Cos’` LTEX
A
LTEX e pronunciato latech (con la chi greca finale), ` un sistema per la preparazione di
e
testi basato sul programma di composizione tipografica TEX.
Fornisce funzioni di desktop publishing programmabili e mezzi per l’automazione della
maggior parte della composizione tipografica, inclusa la numerazione, i riferimenti
incrociati, tabelle e figure, organizzazione delle pagine, bibliografie e molto altro. LATEX
venne creato nel 1985 da Leslie Lamport (adesso ` manutenuto da Frank Mittelbach) ed
e
` divenuto il principale metodo di utilizzo di TEX, poche persone usano ancora
e
direttamente TEX base per la redazione di documenti. La versione attuale ` denominata
e
LATEX 2 .
E. Somma L EXBase
AT 13/12/2007 4 / 61
5. Personaggi importanti
Donald Knuth, Stanford University
Leslie Lamport, Microsoft Research
Frank Mittelbach, LaTeX3 Project
E. Somma L EXBase
AT 13/12/2007 5 / 61
6. A
Versioni di LTEX
A
LTEX 2.09
differenti installazioni: NFSS, SliTeX, AMS-TeX, . . .
A
LTEX 2
NFSS standard
packages: amstex, slitex, . . .
A
LTEX 3 . . .
E. Somma L EXBase
AT 13/12/2007 6 / 61
7. TEX User Group
La Banca d’Italia ` uno dei 25 membri istituzionali mondiali del TEX User Group. Altri
e
membri: (American Mathematical Society, Center of Computer Science, CNRS France,
IBM Corporation, Max Plank Insitute, Stanford Linear Accelerator Center, University:
Duke, Florida State, New York, Stanford, Stockholm, Delaware, Laval, Oslo, Uppsala,
Vanderbilt,. . .)
La rivista del TUG ` TUGboat (disponibile presso la SIA)
e
Il sito ` http://www.tug.org
e
E. Somma L EXBase
AT 13/12/2007 7 / 61
8. Riferimenti
Leslie Lamport LaTeX - A Document Preparation System Addison-Wesley Reading
Massachusetts, second edition, 1994
Michel Goossens, Frank Mittelbach and Alexander Samarin. The LATEX Companion
Addison-Wesley, Reading, Massachusetts, 1994
http://www.tug.org
http://www.latex-project.org
3652
E. Somma L EXBase
AT 13/12/2007 8 / 61
9. Part II
A
LTEX
E. Somma L EXBase
AT 13/12/2007 9 / 61
12. A
1, 2, 3 . . . LTEX
A
LTEX 2.09 A
LTEX 2
documentstyle[<opts>]{<style>} documentclass[<opts>]{<class>}
usepackage[<opts>]{<packages>}
begin{document} begin{document}
... ...
end{document} end{document}
E. Somma L EXBase
AT 13/12/2007 12 / 61
13. A
1, 2, 3 . . . un esempio di LTEX
A
LTEX 2.09 A
LTEX 2
documentstyle[twoside,epsfig, documentclass[twoside]{article}
multicol]{article} usepackage{epsfig}
usepackage{multicol}
begin{document} begin{document}
... ...
end{document} end{document}
E. Somma L EXBase
AT 13/12/2007 13 / 61
14. Classi e package standard
Classi: article, book, report, letter, slides, minimal
Package: alltt, doc, exscale, fontenc, graphpap, ifthen, inputenc, latexsym, makeidx,
newlfont, oldlfont, showidx, syntonly, tracefnt,
E. Somma L EXBase
AT 13/12/2007 14 / 61
18. Elementi del linguaggio TEX
Commenti: % fino a fine riga
Comandi: ComandoSenzaArgomenti, ComandoCon1Argomento oppure
ComandoRicco{arg1}{arg2}...{arg9} (riconosce maiuscole e minuscole, ovvero
delta != Delta)
Contatori: nomevar=1
Dimensioni: dimen0=1pc ( dimensioni accettate mm,cm,pt,pc,em,ex,...)
Spazio non interrompibile: ~ (L. Torvalds)
Spazio sicuro: (finecomando inizio)
Caratteri accentati: ``... "u (Br"{u}lhart)
ae
Gruppi: textit{ciao}
E. Somma L EXBase
AT 13/12/2007 18 / 61
19. Elementi del linguaggio TEX
Virgolette: ’, ", ’’
Lineette: - (a capo), -- (numerico), --- (segno di punteggiatura, discorso)
A capo: -
Simboli speciali: # $ % & ~ _ ^ { }
Spazio troppo speciali: $>$, $<$, $backslash$
E. Somma L EXBase
AT 13/12/2007 19 / 61
20. A
Elementi propri del linguaggio LTEX
Opzioni dei Comandi: Comando[opz1,opz2,...]{arg1}
Ambienti: begin{nome}[opz,...] <contenuto> end{nome}
Forme alternate: section{} section*{}
Errori: ! LaTeX Error: ...
E. Somma L EXBase
AT 13/12/2007 20 / 61
21. A
Un programma LTEX
% Preambolo
documentclass[<opts>]{<class>}
usepackage[<opts>]{<packages>}
...
% Documento
begin{document}
...
end{document}
E. Somma L EXBase
AT 13/12/2007 21 / 61
22. Preambolo
Tutto quello che c’` prima di
e
begin{document}
Comandi:
documentclass o documentstyle,
usepackage,
listfiles,
setcounter
E. Somma L EXBase
AT 13/12/2007 22 / 61
23. Comando: documentclass
documentclass A
Classe LTEX 2
Uso:
documenclass[<opts>]{<class>}
dove <class> `:
e
article
book
report . . .
Esempio:
documentclass [ twoside ]{ article }
documentclass [ slides ]{ beamer }
¦
¥
E. Somma L EXBase
AT 13/12/2007 23 / 61
24. Comando: usepackage
usepackage Attivazione package esterno
Uso:
usepackage[opts]{name}
dove name ` uno dei package supportati dalla distribuzione. Ad es.:
e
graphicx
url
inputenc . . .
Esempio:
usepackage [ latin1 ]{ inputenc }
usepackage [ italian ]{ babel }
usepackage { listings }
¦
¥
E. Somma L EXBase
AT 13/12/2007 24 / 61
25. Comando: listfiles
listfiles Elenca i file usati nel log
Uso:
listfiles
Esempio:
* File List *
beamer . cls 2007/03/11 cvs version 3.07 A class for typesetting presentations ( rcs - revisi
beamerbasercs . sty 2007/01/28 ( rcs - revision 1.4)
bea me rb a se mo de s . sty 2007/01/28 ( rcs - revision 1.22)
b e a m e rb a s e d e c o de . sty 2007/01/28 ( rcs - revision 1.20)
be a m e r b a s e o p t i o ns . sty 2007/01/28 ( rcs - revision 1.8)
[...]
¦
¥
E. Somma L EXBase
AT 13/12/2007 25 / 61
26. Comando: setcounter
setcounter Definisci il valore di un contatore
Uso:
setcounter{nome}{valore}
dove nome ` il nome di un contatore e valore ` un valore numerico.
e e
Esempio:
setcounter { e r r orc ont ext line s }{999}
¦
¥
E. Somma L EXBase
AT 13/12/2007 26 / 61
27. Part III
A
Documento LTEX
1 Comandi
2 Ambienti
3 Matematica
4 Riferimenti Bibilografici
5 Titoli
E. Somma L EXBase
AT 13/12/2007 27 / 61
28. Comandi
Comandi
1 Comandi
2 Ambienti
3 Matematica
4 Riferimenti Bibilografici
5 Titoli
E. Somma L EXBase
AT 13/12/2007 28 / 61
29. Comandi
Comandi in un documento TEX
Formato: emph{per dare enfasi}
Struttura: section{Titolo di sezione} (a capo), -- (numerico), --- (segno di
punteggiatura, discorso)
Riferimento: ref, pageref, label{}
Ambienti:
begin{theorem}
bla bla bla
end{theorem}
Matematica: $L=sum_{i=1}^{M}L_i$
E. Somma L EXBase
AT 13/12/2007 29 / 61
30. Comandi
Comandi di formattazione
Una buona norma:
USARE SOLO UN TIPO DI ENFASI:
emph{bla bla bla}
Da non usare: variazioni di stile
textbf{bla bla bla}
textit{bla bla bla}
textsl{bla bla bla}
Ma si usano nella matematica
E. Somma L EXBase
AT 13/12/2007 30 / 61
31. Comandi
Comandi di strutturazione
Dipendono dalla classe del documento.
chapter section subsection subsubsection paragraph subparagraph
Inserimento nella tabella dei contenuti
chapter{Pippo}
chapter[Titolo Lungo]{Un titolo troppo lungo per essere impaginato nell
chapter*{Pippo}
Sommario: tableofcontents (DOPPIO GIRO!)
E. Somma L EXBase
AT 13/12/2007 31 / 61
32. Comandi
Comandi di riferimento
Definizione delle etichette chapter{Pinco Pallino}label{pinco-pa} Uso del
riferimento:
. . . come si pu` leggere nel Capitolo ref{pinco-pa} a pagina
o
pageref{pinco-pa}
RICORDARE SEMPRE: quando ci sono i riferimenti bisogna lanciare DUE volte il
comando di compilazione del documento
E. Somma L EXBase
AT 13/12/2007 32 / 61
33. Comandi
Altri comandi
Note a pi´ pagina: footnote{}
e
Note a margine: marginpar{}
Testo dattiloscritto: verb-comando-
Numerazione delle pagine: pagenumbering{arabic} (oppure
roman, Roma, alph, Alph)
Avanzamento pagina: clearpage oppure pagebreak, contrario samepage
Spazio verticale: vspace{1cm} vspace*{},
smallskip, medskip, bigskip, fill
Spazio orizzontale: hspace{1cm} hspace*{}
E. Somma L EXBase
AT 13/12/2007 33 / 61
34. Ambienti
Ambienti
1 Comandi
2 Ambienti
3 Matematica
4 Riferimenti Bibilografici
5 Titoli
E. Somma L EXBase
AT 13/12/2007 34 / 61
35. Ambienti
Ambiente: quotation
begin { quotation }
noindent { small ‘‘ How do we construct demand measures
in the presence of more than two countries ? Indeed
emph { how does one even formulate the home market effect
hypothesis }? The ratios and shares of the theoretical
formulations neglect third country effects . ’ ’}
end { quotation }
¦
¥
E. Somma L EXBase
AT 13/12/2007 35 / 61
36. Ambienti
Ambiente: picture
begin { picture }(50 ,50)
thicklines
qbezier (0 ,0)(0 ,50)(50 ,50)
qbezier [20](0 ,0)(50 ,0)(50 ,50)
thinlines
put (0 ,0){ line (1 ,1){50}}
end { picture }
¦
¥
E. Somma L EXBase
AT 13/12/2007 36 / 61
37. Ambienti
Ambiente: verbatim
begin { verbatim }
rho = (1+ sqrt (5))/2
rho =
1.6180
a = abs (3+4 i )
a =
5
z = sqrt ( besselk (4/3 , rho - i ))
z =
0.3730 + 0.3214 i
huge = exp ( log ( realmax ))
huge =
1.7977 e +308
toobig = pi * huge
toobig =
Inf
end { verbatim }
¦
¥
E. Somma L EXBase
AT 13/12/2007 37 / 61
38. Ambienti
Ambiente: Liste itemize, enumerate
begin { itemize }
item Leslie Lamport [...]
item Michel Goossens , Frank Mittelbach and Alexander Samarin . [...]
item url { http :// www . tug . org }
item url { http :// www . latex - project . org }
item $3652$
end { itemize }
¦
¥
Leslie Lamport [...]
Michel Goossens, Frank Mittelbach and Alexander Samarin. [...]
http://www.tug.org
http://www.latex-project.org
3652
E. Somma L EXBase
AT 13/12/2007 38 / 61
39. Ambienti
Ambiente: Descrizione description
begin { description }
item [ Leslie Lamport ] textit { LaTeX - A Document Preparation System } ...
item [ Michel Goossens , Frank Mittelbach and Alexander Samarin ] textit { The LATEX Companion } .
end { description }
¦
¥
Leslie Lamport LaTeX - A Document Preparation System ...
Michel Goossens, Frank Mittelbach and Alexander Samarin The LATEX Companion ...
E. Somma L EXBase
AT 13/12/2007 39 / 61
40. Ambienti
Ambiente: Giustificazione paragrafi center, flushright, flushleft
begin { center }
And the battles just begun
Theres many lost , but tell me who has won
The trench is dug within our hearts
And mothers , children , brothers , sisters torn apart
Sunday , bloody sunday
Sunday , bloody sunday
end { center }
¦
¥
And the battles just begun
Theres many lost, but tell me who has won
The trench is dug within our hearts
And mothers, children, brothers, sisters torn apart
Sunday, bloody sunday
Sunday, bloody sunday
E. Somma L EXBase
AT 13/12/2007 40 / 61
41. Ambienti
Ambiente: Oggetti Volanti - figure
begin { center }
begin { figure }[ h ]
caption [ Nella LOF ]{ Una bella figura }
vspace {5 cm }
label { figone }
end { figure }
end { center }
¦
¥
Figure: Una bella figura
E. Somma L EXBase
AT 13/12/2007 41 / 61
42. Ambienti
Ambiente: Oggetti Volanti - table
begin { center }
begin { table }[ h ]
caption [ Nella LOT ]{ Una bella tabella }
vspace {5 cm }
label { tabone }
end { table }
end { center }
¦
¥
Table: Una bella tabella
E. Somma L EXBase
AT 13/12/2007 42 / 61
43. Ambienti
Tabelle
begin { tabular }{ lccccccc }
multicolumn {7}{ c }{ text { Table 2 --- ’ Pairwise $ Z $ - tests ’ and
accessibility - adjusted ’ pairwise $ Z $ - tests ’}}
hline hline
text { ISIC } quad text { Industry classification } OECD OECD [...]
hline
$ M $ $ % $ with $ lambda $ $%$ with $ lambda ^{ mathrm { size }}$ [...]
hline
311 qquad Food products 20 54.2 59.5$^{ mathbf { ast ast }}$ 20
43.2 43.2
¦
¥
E. Somma L EXBase
AT 13/12/2007 43 / 61
44. Ambienti
Ambiente: equation
begin { equation }
mathrm { RMP }= Phi mathrm { diag }( Phi lambda )^{ -1}
theta leq mathbf {1} , label { equ }
end { equation }
with the complementary slackness conditions
begin { equation *}
( mathrm { RMP }_{ i } -1) lambda _{ i }=0
qquad i =1 ,2 , ldots M .
end { equation *}
¦
¥
−1
RMP = Φdiag(Φλ) θ ≤ 1, (1)
with the complementary slackness conditions
(RMPi − 1)λi = 0 i = 1, 2, . . . M.
E. Somma L EXBase
AT 13/12/2007 44 / 61
45. Matematica
Matematica
1 Comandi
2 Ambienti
3 Matematica
4 Riferimenti Bibilografici
5 Titoli
E. Somma L EXBase
AT 13/12/2007 45 / 61
46. Matematica
Matematica Semplice
begin { equation }
sum _{ j }
dfrac { phi _{ ij } theta _{ j }}
{ sum _{ k } phi _{ kj } lambda _{ k }}
leq 1 ,
qquad
i =1 ,2 , ldots ,M . label { firms 2}
end { equation }
¦
¥
φij θj
≤ 1, i = 1, 2, . . . , M. (2)
j k φkj λk
E. Somma L EXBase
AT 13/12/2007 46 / 61
47. Matematica
Matematica Semplice
mathrm { ri }( Delta )=
biggl {
x in mathbf { mathbb { R }}^ M ,;;
sum _{ i } x _{ i }=1 ,;;
x _{ i } 0 ,;
forall i biggr }.
¦
¥
ri(∆) = x ∈ RM , xi = 1, xi 0, ∀i . (3)
i
E. Somma L EXBase
AT 13/12/2007 47 / 61
48. Matematica
Matematica: Sistemi di equazioni
begin { eqnarray }
mathrm { RMP }_{ i } =1
qquad text { if }
qquad lambda _{ i }^{ ast } 0 , notag
mathrm { RMP }_{ i } leq 1
qquad text { if }
qquad lambda _{ i }^{ ast }=0.
label { firms 3}
end { eqnarray }
¦
¥
RMPi = 1 if λ∗ 0,
i
RMPi ≤ 1 if λ∗ = 0.
i (4)
E. Somma L EXBase
AT 13/12/2007 48 / 61
49. Matematica
Matematica: Matrici e Vettori
Phi equiv left (
begin { array }{ cccc }
phi _{11} phi _{12} cdots phi _{1 M }
phi _{21} phi _{22} cdots phi _{2 M } vdots
vdots ddots vdots phi _{ M 1} phi _{ M 2} cdots phi _{ MM }
end { array }
right ) ,;;
lambda equiv left ...
¦
¥
E. Somma L EXBase
AT 13/12/2007 49 / 61
51. Riferimenti Bibilografici
Riferimenti bibliografici
Citazioni Riferimenti
a mano a mano (liste)
(see Helpman, 1998) |item Helpman, E. (1998) Explaining the struc-
ture of foreign trade, emph{Weltwirtschaftliches
Archiv} 134, 573-589.
a mano harwarditem...
(see Helpman, 1998) harvarditem{}{}{} Helpman, E. (1998)
Explaining the structure of foreign trade,
emph{Weltwirtschaftliches Archiv} 134,
573-589.
BiBTeX cite cite{helpman:ft} thebibliografy+bibitem
BibTeX
E. Somma L EXBase
AT 13/12/2007 51 / 61
52. Riferimenti Bibilografici
thebibliograhy+bibitem
begin { t he bi bl iography }{ la - piu - lunga }
bibitem { lab : pippo } AuthorName , F . , ’’ Title , ’ ’ textit { Journal }
textbf { volume } ( number ) , ( City , State , Country : Publisher ,
day mon . year ): page - page -
...
end { th eb ib l io graphy }
¦
¥
bla bla (vedi cite[p. 2]{lab:pippo}) bla bla
E. Somma L EXBase
AT 13/12/2007 52 / 61
53. Riferimenti Bibilografici
BibTeX
File bibliografico ’generico’ (si trovano
anche su internet) dei riferimenti
(bibfile)
File di stile (si trova su internet)
Eliminare la sezione
begin{thebibliography}
...
end{thebibliography}
Aggiungere
bibliographystyle{%
nomedellostile.bst}
bibliography{bibfile}
E. Somma L EXBase
AT 13/12/2007 53 / 61
54. Riferimenti Bibilografici
Record BibTeX
@InProceedings{ fantechi:97,
author = {A. Fantechi and Paolo Nesi and E. Somma},
title = {Object-Oriented Analysis of COBOL},
booktitle = csmr1,
month = mar, year = {1997},
publisher = ieeecsp,
abstract = {The object-oriented paradigm is presently considered the one
which best guarantees the investments for renewal. It allows to produce
software with high degrees of reusability and maintainability, satisfying
in a certain measure also quality characteristics. These features are not
obviously automatically guaranteed by the simple adoption of an
object-oriented programming language, a process of re- analysis is needed.
In this view, several methods for reengineering old applications according
to the object-oriented paradigm were defined and proposed. In this paper, a
method and tool (C2O2, COBOL to Object-Oriented) for analyzing COBOL
applications in order to extract its object-oriented analysis is presented.
The tool identifies classes and their relationships by means of a process of
understanding and refinement in which COBOL data structures are analyzed,
converted in classes, aggregated, and simplified semiautomatically. The
algorithm is also capable of detecting data structures which can cause problems
passing to the next millennium, as demonstrated with an example.},
class = {Reverse_Engineering, Reverse_Design,
Encapsulation_and_Finding_Objects_in_Legacy_Code},
sender = {antonio@ifi.unizh.ch} }
E. Somma L EXBase
AT 13/12/2007 54 / 61
58. Titoli
Titoli
1 Comandi
2 Ambienti
3 Matematica
4 Riferimenti Bibilografici
5 Titoli
E. Somma L EXBase
AT 13/12/2007 58 / 61
59. Titoli
Titoli e classificazione
title { Testing the ‘ home market effect ’ in a multi - country [...] }
author { Kristian Behrens
thanks { emph { Corresponding author }: CORE , Universit ’{ e } catholique
de Louvain , 34 voie du Roman Pays , 1348 Louvain - la - Neuve , Belgium .
Phone : (+ 32)10474305. Fax : (+32)10474301. E - mail address :
texttt { behrens@core . ucl . ac . be }}
Andrea R . Lamorgese
thanks { Research Department , Bank of Italy , Roma .}
and Gianmarco I . P . Ottaviano
thanks { Universit ‘{ a } di Bologna ( Italy ) , FEEM and CEPR .}
Takatoshi Tabuchi
thanks { Faculty of Economics , University of Tokyo , Japan .}}
date {}
maketitle
¦
¥
E. Somma L EXBase
AT 13/12/2007 59 / 61
60. Titoli
Abstract e classificazione
begin { abstract }
We propose a theory - based approach to testing the presence of the [...]
end { abstract }
textbf { Keywords : } home market effect ; new trade theory ; multi - country models ;
market potential ; economic geography
textbf { JEL Classification :} D 58; F 12; F 17; R 12
newpage begin { center }{} end { center }
newpage t a bl eofcontents % vspace {1.2 cm } newpage
¦
¥
E. Somma L EXBase
AT 13/12/2007 60 / 61
61. Titoli
Ringraziamenti
newpage
medbreak noindent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
We wish to thank A .~ Anas , M .~ Br { u } lhart , D .~ Davis , G .~ Grossman , K .~ Head ,
E .~ Helpman , T .~ Mayer , C .~ Michelot , S .~ Redding , F .~ Trionfetti , J .~ Suedekum ,
and D .~ Weinstein , as well as seminar participants at CORE Universit ’{ e }
catholique de Louvain , the University of Osaka , FEMES 2004 , ERWIT 2004 ,
HWWA Hamburg , and the RSAI 2004 North - American Meeting for helpful comments
and discussions .
newpage
begin { doublespacing }
section { Introduction }
¦
¥
E. Somma L EXBase
AT 13/12/2007 61 / 61