• No se han encontrado resultados

Introducci´on a la escritura cient´ıfica en L

N/A
N/A
Protected

Academic year: 2023

Share "Introducci´on a la escritura cient´ıfica en L"

Copied!
109
0
0

Texto completo

(1)

Introducci´ on a la escritura cient´ ıfica en

L

A

TEX 2ε

David G´omez-Castro

Departamento de An´alisis Matem´atico y Matem´atica Aplicada Universidad Complutense de Madrid

[email protected]

https://blogs.mat.ucm.es/dgcastro

Diciembre 2018

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 1 / 80

(2)

Desarrollo del curso I

Sesi´on 1: Bienvenido a LATEX

1 Instalaci´on

2 ¡Hola Mundo! e ingredientes b´asicos

Sesi´on 2: LATEX para Matem´aticas

3 F´ormulas

Distintos tipos de f´ormulas S´ımbolos

Matrices Diagramas

4 Teoremas

(3)

Desarrollo del curso II

Sesi´on 3: LATEX como editor de texto avanzado

5 Insertando objetos Figuras

Tablas C´odigos

6 Formato avanzado Secciones e ´ındices El formato de p´agina El formato de la Facultad Sesi´on 4: Referencias

7 Referencias a elementos del texto Etiquetas

Referencias b´asicas de LATEX El paquete cleveref

8 Referencias a bibliograf´ıa

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 3 / 80

(4)

Desarrollo del curso III

Sesi´on 5:

9 Presentaciones en Beamer

Sesi´on 6:

10 Gr´aficos avanzados Dibujo libre

Representaci´on de funciones Representaci´on de datos

(5)

Material de apoyo

Url

Google. Si no: lmgtfy.com TEX Stack Exchange

The not so short introduction to LaTeX2e (actualmente en 139 minutos)

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 5 / 80

(6)

Sesi´ on I

Bienvenido a L

A

TEX

(7)

¿Qu´ e es L

A

TEX?

LATEX es un sistema de preparaci´on de documentos, utilizado en documentos cient´ıficos y t´ecnicos.

LATEX ¡no es un procesador de textos! Nos permite separar el contenido del continente, dejando el formato a un lado.

Por eso, LATEX se escribe en documentos de texto “sin formato” con una cabecera que dice c´omo ser´a el formato (tipo de letra, espaciados, m´argenes, t´ıtulos...).

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 7 / 80

(8)

¿Por qu´ e L

A

TEX?

¿Qui´en lo usa?

1 Las principales revistas del mundo: Nature, Science, PNAS, PLOS, ...

2 Todas las revistas de Matem´aticas

3 Los profesores en sus apuntes (en la UCM y en todas partes)

ARTICLE

doi:10.1038/nature16059

Undecidability of the spectral gap

Toby S. Cubitt1,2, David Perez-Garcia3,4 & Michael M. Wolf5

The spectral gap is one of the most important physical properties of a quantum many-body system, determining much of its low- energy physics. Gapped systems exhibit non-critical behaviour (for example, massive excitations and short-range correlations), whereas phase transitions occur when the spectral gap vanishes and the sys- tem exhibits critical behaviour (for example, massless excitations and long-range correlations). Many seminal results in condensed matter theory prove that specific systems are gapped or gapless, for exam- ple, that the Heisenberg chain is gapless for half-integer spin1 (later extended to higher dimensions2), or that the 1D AKLT (Affleck–

Kennedy–Lieb–Tasaki) model is gapped3. Similarly, many famous and long-standing open problems in theoretical physics concern the presence or absence of a spectral gap. A paradigmatic example is the antiferromagnetic Heisenberg model in 1D with integer spins.

The ‘Haldane conjecture’ that this model is gapped, first formulated in 19834, has yet to be rigorously proven despite strong supporting numerical evidence5. The same question in the case of 2D non-bipartite lattices such as the kagome lattice was posed in 19736. Numerical evidence7 strongly indicates that these systems may be topological spin liquids. This problem has attracted substantial attention8 because materials such as herbertsmithite9 have emerged whose interactions are well-approximated by the Heisenberg coupling. The presence of a spectral gap in these models remains one of the main unsolved ques- tions concerning the long-sought topological spin liquid phase. In the related setting of quantum field theory, one of the most notorious open problems again concerns a spectral gap—the Yang–Mills mass gap problem10. Proving the existence of a gap in Yang–Mills theory could provide a full explanation of the phenomenon of quark con- finement. Although there is strong supporting evidence of such a gap from numerical lattice quantum chromodynamics computations11, the problem remains open.

All of these problems are specific instances of the general spectral gap problem: given a quantum many-body Hamiltonian, is the system it describes gapped or gapless? Our main result is to prove that the spectral gap problem is undecidable in general. This involves more than

hard. Although one may be able to solve the spectral gap problem in specific cases, our result implies that it is, in general, logically impossi- ble to determine whether a system is gapped or gapless. This statement has two meanings, and we prove both.

(1) The spectral gap problem is algorithmically undecidable: there cannot exist any algorithm that, given a description of the local inter- actions, determines whether the resultant model is gapped or gapless.

This is the same sense in which the halting problem is undecidable12. (2) The spectral gap problem is axiomatically independent: given any consistent recursive axiomatization of mathematics, there exist particular quantum many-body Hamiltonians for which the presence or absence of the spectral gap is not determined by these axioms. This is the form of undecidability encountered in Gödel’s incompleteness theorem13.

Precise statement of results

It is important to be precise in what we mean by the spectral gap prob- lem. To this end, we must first specify the systems we are considering.

Because we are proving undecidability, the simpler the system, the stronger the result. We restrict ourselves to nearest-neighbour, trans- lationally invariant spin lattice models on a 2D square lattice of size L × L (which we later take to ∞), with local Hilbert space dimension d. Any such Hamiltonian HL is completely specified by at most three finite-dimensional Hermitian matrices describing the local interactions of the system: two d2 × d2 matrices hrow and hcol that specify the inter- actions along the rows and columns of the lattice, and a d × d matrix h1 that specifies any on-site interaction. All matrix elements will be algebraic numbers, and we normalize the interaction strength such that

h h h =

max{ row, col, 1} 1.

We must also be precise in what we mean by ‘gapped’ and ‘gapless’

(see Fig. 1). Because quantum phase transitions occur in the ther- modynamic limit of arbitrarily large system size, we are interested in the spectral gap ∆(HL) = λ1(HL) − λ0(HL) as the system size L → ∞ (where λ0 and λ1 are the eigenvalues of HL with the smallest and second-smallest magnitude). We take ‘gapped’ to mean that the system has The spectral gap—the energy difference between the ground state and first excited state of a system—is central to quantum many-body physics. Many challenging open problems, such as the Haldane conjecture, the question of the existence of gapped topological spin liquid phases, and the Yang–Mills gap conjecture, concern spectral gaps. These and other problems are particular cases of the general spectral gap problem: given the Hamiltonian of a quantum many-body system, is it gapped or gapless? Here we prove that this is an undecidable problem. Specifically, we construct families of quantum spin systems on a two-dimensional lattice with translationally invariant, nearest-neighbour interactions, for which the spectral gap problem is undecidable. This result extends to undecidability of other low-energy properties, such as the existence of algebraically decaying ground-state correlations. The proof combines Hamiltonian complexity techniques with aperiodic tilings, to construct a Hamiltonian whose ground state encodes the evolution of a quantum phase-estimation algorithm followed by a universal Turing machine. The spectral gap depends on the outcome of the corresponding ‘halting problem’. Our result implies that there exists no algorithm to determine whether an arbitrary model is gapped or gapless, and that there exist models for which the presence or absence of a spectral gap is independent of the axioms of mathematics.

ARTICLE RESEARCH

2 0 8 | N A T U R E | V O L 5 2 8 | 1 0 D E C E M B E R 2 0 1 5

∆(HL) ≥ γ > 0 for all sufficiently large L. We take ‘gapless’ to mean the system has continuous spectrum above the ground state in the thermodynamic limit.

Here gapped is not the negation of gapless; there are systems that fall into neither category. We adopt such strong definitions to delib- erately exclude ambiguous cases, such as systems with degenerate ground states. A Hamiltonian that is gapped or gapless according to the above definitions is recognized as such throughout the literature.

We show that the spectral gap problem is undecidable even given that the Hamiltonian either has a unique ground state and a spectral gap of magnitude one, or has continuous spectrum above the ground state.

We prove this by showing that the halting problem for Turing machines can be encoded in the spectral gap problem, implying that the latter is at least as hard as the former. A Turing machine is a simple, abstract model of computation in which a head reads and writes sym- bols from some finite alphabet on an infinite tape and moves left or right, following a finite set of rules. The halting problem asks: given an initial input written on the tape, does the Turing machine halt? Turing proved that this problem is undecidable12; we relate it to the spectral gap problem in the following way.

Theorem 1

We can explicitly construct a dimension d, d2 × d2 matrices A, B, C and D, and a rational number β > 0, which can be chosen to be as small as desired, such that

(i) A is Hermitian, with matrix elements in Z+βZ+β2Z; (ii) B and C have integer matrix elements; and (iii) D is Hermitian, with matrix elements in {0, 1, β}.

For each positive integer n, define the local interactions of a transla- tionally invariant, nearest-neighbour Hamiltonian H(n) on a 2D square lattice as

α Π β ( ) = ( )

=

= + (π ( )ϕ +−π ( )ϕ + π−| ( )|ϕ +−π−| ( )|ϕ )

h n n

h D

h A ei nB ei nB ei Cei C 1

row

col 2 n 2 n

where ϕ( ) = /n n 2| |−n 1 is the rational number whose binary fraction expansion contains the binary digits of n after the decimal point, |ϕ(n)|

denotes the number of digits in this expansion, α(n) ≤ β is an algebraic number that is computable from n, Π is a projector and the daggers denote Hermitian conjugation. Then

(i) the local interaction strength is ≤1 (that is, h n1( ),hrow,h ncol( ) ≤1

( ) ( ) ≤

h n1 ,hrow,h ncol 1);

(ii) if the universal Turing machine halts on input n, the Hamiltonian H(n) is gapped with γ ≥ 1; and

(iii) if the universal Turing machine does not halt on input n, the Hamiltonian H(n) is gapless (that is, has continuous spectrum).

Theorem 1 implies that the spectral gap problem is algorithmically undecidable because the halting problem is. By a standard argument14 algorithmic undecidability also implies axiomatic independence. Both forms of undecidability extend to other low-temperature properties of quantum systems, such as critical correlations in the ground state.

In fact, our method allows us to prove undecidability of any physical property that distinguishes a Hamiltonian from a gapped system with unique, product ground state.

Hamiltonian construction

We first relate undecidability of the spectral gap to undecidability of another important physical quantity, the ground state energy density, which, for a 2D lattice, is given by Eρ=lim [→∞λ( )/H L]

L 0 L 2. We then transform the halting problem into a question about ground state energy densities.

Reducing the ground state energy density problem to the spectral gap problem requires two ingredients.

(1) It requires a translationally invariant Hamiltonian Hu(ϕ) on a 2D square lattice with local interactions hu(ϕ), whose ground state energy density is either strictly positive or tends to zero from below in the thermodynamic limit, depending on the value of an external parame- ter ϕ; however, determining which case holds should be undecidable.

Constructing such a Hamiltonian constitutes the main technical work of our result. (These properties of Hu(ϕ) are unaffected if we multiply hu(ϕ) by an arbitrary fixed rational number β, no matter how small.)

(2) It requires a gapless Hamiltonian Hd with translationally invariant local interactions hd and a ground state energy of zero. (Recall that by

‘gapless’ we mean continuous spectrum above the ground state, not merely a vanishing spectral gap.) There are many well-known examples of such Hamiltonians, for example, that associated with the critical XY model1.

Given Hamiltonians with these properties, we construct a new trans- lationally invariant Hamiltonian, with local interactions h(ϕ), that is gapped or gapless depending on the value of ϕ. The local Hilbert space of h(ϕ) is the tensor product of those of hu and hd together with one additional energy level: H= | 〉 ⊕0 HuHd. We take the interaction h(i, j) between nearest-neighbour sites i and j to be

ϕ ϕ

( ) = | 〉〈 | ⊗ ( −| 〉〈 |) + ( ) ⊗

+ ( )

( ) ( ) ( ) () ( )

() ()

! !

!

h h

h

0 0 0 0

1

i j i j i j i j

i j i j

, u,

d, u,

d, The spectrum of the new Hamiltonian H is

ϕ

= ( ) + ( )

H H H S

spec {0} {specu spec }d 2

with S ≥ 1 (see Supplementary Information for details). Recalling that we chose Hd to be gapless, we see immediately from equation (2) that if the ground state energy density of Hu tends to zero from below (so that λ0(Hu) < 0), then H(ϕ) is gapless; if Hu has a strictly positive ground state energy density (so that λ0(Hu) diverges to +∞), then it has a spectral gap ≥1, as required (see Fig. 2).

This construction is rather general: by choosing different hd, we obtain undecidability of any physical property that distinguishes a Hamiltonian from a gapped system with a unique product ground state.

Encoding computation in ground states To construct the Hamiltonian Hu(ϕ), we encode the halting problem into the local interactions hu(ϕ) of the Hamiltonian. The halting prob- lem concerns the dynamics of a classical system—a Turing machine.

To relate it to the ground state energy density—a static property of a quantum system—we construct a Hamiltonian whose ground state encodes the entire history of the computation carried out by the Turing Figure 1 | Gapped and gapless systems. a, A gapped system has a unique

ground state λ0(H) and a constant lower-bound γ on the spectral gap

∆(H) = λ1 − λ0 in the thermodynamic limit. b, A gapless system has continuous spectrum λi(H) above the ground state in the thermodynamic limit.

i(H)

(H) ≥ Δ 1

0 0

a b

© 2015 Macmillan Publishers Limited. All rights reserved

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 8 / 80

(9)

Descargar e instalar L

A

TEX

Esta experiencia depende del sistema utilices: visita Latex project Windows: MikTeX

Mac: MacTeX

Linux: a trav´es del gestor software nativo de terminal Debian/Ubuntu: sudo apt-get install texlive-full RedHat/Fedora: yum install texlive-scheme-full Suse: zypper install texlive-latex

Arch: pacman -S texlive-most

Otros: ¿en serio? ¿ninguno de los anteriores?. Te buscas la vida.

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 9 / 80

(10)

Descargar el editor

TeXstudio

Durante esta lecciones utilizaremos el editor TeXstudio. Es libre y gratuito1.

Hay m´as opciones:

1 TeXShop

2 TexMaker

3 Gummy

4 Atom (requiere alguna configuraci´on)

5 Emacs, Vim, etc... + compilaci´on por terminal

(11)

TeXstudio

Figura:Interfaz de TeXstudio

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 11 / 80

(12)

El archivo m´ ınimo

Los archivos de LATEX son archivos de texto (plano) con extension .tex.

Aqu´ı es donde decidimos que tipo de archivo latex queremos escribir, hay diferentes tipos de documentos

C´odigo

\documentclass{<style>}

% Configuracion del archivo

\begin{document}

% El texto

\end{document}

(13)

El archivo ¡Hola Mundo!

Aqu´ı es donde decidimos qu´e tipo de archivo latex queremos escribir, hay diferentes tipos de documentos

C´odigo [hola-mundo.tex]

\documentclass{article}

\begin{document}

Hola Mundo

\end{document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 13 / 80

(14)

Compilando con TeXstudio

(15)

Compilando en terminal

Navegar hasta la carpeta y escribir en terminal latex hola-mundo.tex

En archivos m´as complicados hay que ejecutar el c´odigo varias veces

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 15 / 80

(16)

Cabecera y tipo de documento

En la cabecera introduciremos todo lo relativo a configuraci´on C´odigo

\documentclass{<style>}

% Configuracion del archivo

\begin{document}

% El texto

\end{document}

(17)

Tipo de documento

Aqu´ı es donde decidimos que tipo de archivo latex queremos escribir, hay diferentes tipos de documentos

<style>:

1 article Para art´ıculos cortos. Acepta partes, secciones y subsecciones

2 book

C´odigo

\documentclass{<style>}

% Configuracion del archivo

\begin{document}

% El texto

\end{document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 17 / 80

(18)

Tipo de documento

Aqu´ı es donde decidimos que tipo de archivo latex queremos escribir, hay diferentes tipos de documentos

<style>:

1 article

2 book Para archivos m´as extensos. Acepta partes, cap´ıtulos, secciones, subsecciones

C´odigo

\documentclass{<style>}

% Configuracion del archivo

\begin{document}

% El texto

\end{document}

(19)

El cuerpo

A partir de aqu´ı escribiremos el texto

Todo lo que queramos escribir.

C´odigo

\documentclass{<style>}

% Configuracion del archivo

\begin{document}

% El texto

\end{document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 18 / 80

(20)

Comandos y variables

Una herramienta fundamental en la escritura con LATEX

<command> Nombre del comando

<opt> Argumento optativo.

<arg> Argumento obligatorio

C´odigo (llamada a comando)

\<command>[<opt>]{<arg1>}{<arg2>}

(21)

Entornos

Los entornos funcionan como comandos, pero nos permiten introducir cantidades m´as largas de texto.

Algunos ejemplos son document: Es donde introducimos el documento equation: Para introducir ecuaciones numeradas

emph: Para conseguir textos en cursiva.

C´odigo

\begin{<env>}[<opt>]

\end{<env>}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 20 / 80

(22)

Los paquetes

Por defecto LATEX no incluye demasiados comandos ni entornos. Podemos a˜nadir nuevas funcionalidades (comandos y entornos) incluyendo

paquetes.

Uno de los paquetes m´as usuales es el paquete matem´atico de la American Mathematical Society (AMS): amsmath.

C´odigo

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation}

\sum_{i=1}ˆ3 a_i = 1.

\end{equation}

X3 i=1

ai= 1. (1)

(23)

Creando comandos

C´odigo

\documentclass{standalone}

\newcommand{\deciralgo}[1]

{Esto es lo que digo: ‘‘#1’’.

Y no me arrepiento.}

\begin{document}

\deciralgo{Hola}

\end{document}

Esto es lo que digo: “Hola”. Y no me arrepiento.

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 22 / 80

(24)

El fichero y compatibilidades

El paquete inputenc

Para mayor compatibilidad, especialmente entre sistemas operativos es recomendable guardar los archivos de .tex en formato UTF8. Esto nos permitir´a poner acentos de manera sencilla.

Para indicarle al compilar que hemos hecho eso escribimos.

C´odigo

\documentclass{<style>}

\usepackage[utf8]{inputenc}

\begin{document}

(25)

El fichero y compatibilidades

El paquete inputenc

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 24 / 80

(26)

El paquete babel

Para que LATEX ponga todos los textos autom´aticos en castellano deberemos a˜nadir el paquete babel

Para indicarle al compilar que hemos hecho eso escribimos.

C´odigo

\documentclass{<style>}

\usepackage[spanish]{babel}

\begin{document}

(27)

Ficheros modulares: input

Escribir un libro completo en un ´unico archivo no es c´omodo. Por eso LATEX permite escribir modularmente.

Podemos escribir en diferentes archivos .tex, y luego juntarlos en un principal.

C´odigo [modular.tex]

\documentclass{standalone}

\begin{document}

\input{modulo1.tex}

\input{modulo2.tex}

\end{document}

C´odigo [modulo1.tex]

Un texto.

C´odigo [modulo2.tex]

Otro texto.

Un texto. Otro texto.

Figura:Resultado de compilar modular.tex

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 26 / 80

(28)

Aspecto de un primer documento

C´odigo (ejemplo1.tex)

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage[spanish]{babel}

\title{Mi trabajo a \LaTeX}

\author{Yo \\ Y mi amigo}

\date{\today}

\begin{document}

\maketitle

Este es el principio de mi trabajo.

\end{document}

Mi trabajo a LATEX Yo Y mi amigo 23 de marzo de 2013

Este es el principio de mi trabajo.

1

(29)

Colaboraci´ on en L

A

TEX

LATEX se lleva bien con la colaboraci´on en Dropbox. Naturalmente, es preferible que s´olo una persona edite cada .tex. Por eso, en grupo, es buena idea trabajar en m´odulos.

Otra opci´on es usar alg´un sistema online. Por ejemplo, Overleaf2.

2El sistema ShareLatex es ahora parte de Overleaf

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 28 / 80

(30)

Sesi´ on II

L

A

TEX para Matem´ aticas

(31)

Escribiendo f´ ormulas

Hay diferentes entornos para escribir f´ormulas:

1 En l´ınea

2 Presentada

3 equation

4 align

C´odigo

Puedo escribir $eˆ{i\pi } + 1

= 0$

Puedo escribir ei π+ 1 = 0

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 30 / 80

(32)

Escribiendo f´ ormulas

Hay diferentes entornos para escribir f´ormulas:

1 En l´ınea

2 Presentada

3 equation

4 align

C´odigo

Puedo escribir

$$ eˆ{i\pi } + 1 = 0$$

Puedo escribir

ei π+ 1 = 0

(33)

Escribiendo f´ ormulas

Hay diferentes entornos para escribir f´ormulas:

1 En l´ınea

2 Presentada

3 equation

4 align

C´odigo

Puedo escribir

\begin{equation}

eˆ{i\pi} + 1 = 0

\end{equation}

Puedo escribir

ei π+ 1 = 0 (1)

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 30 / 80

(34)

Escribiendo f´ ormulas

Hay diferentes entornos para escribir f´ormulas:

1 En l´ınea

2 Presentada

3 equation

4 align

C´odigo

Puedo escribir

\begin{align}

eˆ{i\pi} + 1 &= 0 \\

eˆ{i\pi} &= -1

\end{align}

Puedo escribir

ei π + 1 = 0 (1) ei π = −1 (2)

(35)

S´ ımbolos ´ utiles

+ + ε \varepsilon ab \frac{a}{b}

− - δ \delta √

a \sqrt{a}

× \times \partial ab {a}ˆ{b}

÷ \div Ω \Omega

· \cdot π \pi

⊕ \oplus

⊗ \otimes

La web Detexify permite buscar s´ımbolos a partir de un dibujo a mano alzada.

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 31 / 80

(36)

La ecuaci´ on m´ as bella del mundo

La ecuaci´on de Euler, popular por contener algunas de las m´as importantes constantes matem´aticas puede escribirse

C´odigo

eˆ{i\pi} + 1 = 0

ei π + 1 = 0

C´odigo

Puedo escribir la ecuaci´on de Euler $eˆ{i \pi} + 1 = 0$

en l´ınea o presentada

$$ eˆ{i\pi} + 1 = 0$$

para que quede mejor

Puedo escribir la ecuaci´on de Euler ei π + 1 = 0 en l´ınea o presentada

ei π+ 1 = 0 para que quede mejor

(37)

Sub´ ındices y super´ ındices

Los sub´ındices de sumarios e integrales cambian de formato presentado a en l´ınea

C´odigo

En l´ınea digo

$\sum_{i=1}ˆn \int_aˆb$

mientras que presentado

$$ \sum_{i=1}ˆn \int_aˆb $$

En l´ınea digo Pni =1Rab mien- tras que presentado

n

X

i =1

Z b a

Adem´as la funci´on \substack es muy ´util C´odigo

$$\max_{\substack{y \in \Omega \\ |y| > 1}}$$

m´ax

y ∈Ω

|y |>1

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 33 / 80

(38)

Sub´ ındices y super´ ındices

Los sub´ındices de sumarios e integrales cambian de formato presentado a en l´ınea

C´odigo

En l´ınea digo

$\sum_{i=1}ˆn \int_aˆb$

mientras que presentado

$$ \sum_{i=1}ˆn \int_aˆb $$

En l´ınea digo Pni =1Rab mien- tras que presentado

n

X

i =1

Z b a

Adem´as la funci´on \substack es muy ´util C´odigo

$$\max_{\substack{y \in \Omega \\ |y| > 1}}$$

m´ax

y ∈Ω

|y |>1

(39)

Matrices

Las matrices se introducen siempre en entornos matem´aticos. Maple y matlab permiten exportar matrices a LATEX. Hay distintos tipos de matrices predeterminadas en el paquete amsmath.

1 matrix Sin bordes

2 pmatrix Entre ()

3 vmatrix Entre | |

4 bmatrix Entre [ ]

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 34 / 80

(40)

Matrices

Ejemplo

C´odigo

$$

\begin{pmatrix}

1 & 2 & 3 \\

4 & 5 & \\

6 & & 7

\end{pmatrix}

$$

1 2 3 4 5

6 7

(41)

Matrices

Ejemplo

C´odigo

$$

\begin{bmatrix}

1 & 2 & 3 \\

4 & 5 & \\

6 & & 7

\end{bmatrix}

$$

1 2 3 4 5

6 7

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 36 / 80

(42)

El paquete xy-pic

Este paquete se emplea para hacer todo tipo de gr´aficos, por ejemplo el diagrama

A f //

g ◦f 

B

g

C Tiene infinidad de opciones.

(43)

xymatrix

Es la manera m´as sencilla de introducir diagramas. Los elementos que se conectar´an por flechas se introducen en las posiciones de una matriz, de tipo xymatrix

C´odigo

\xymatrix{

A & B \\

& C }

A B

C

Se puede introducir una xymatrix dentro o fuera de f´ormulas, pero deberemos tener cuidado con el contenido.

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 38 / 80

(44)

Las flechas

Dentro de una xymatrix podemos introducir flechas con el comando \ar Admite varios modificadores

1 DestinoColocando la flecha en la casilla de la que parte se coloca un cadena de cuantas casillas a derecha o izquierda y arriba o abajo est´a el destino.

\ar [<hop>]

2 Etiqueta

3 Tipo

4 Curvatura

5 Entrada y salida

u arriba d abajo r derecha l izquierda

a si misma

(45)

Las flechas

Dentro de una xymatrix podemos introducir flechas con el comando \ar Admite varios modificadores

1 Destino

2 EtiquetaSe puede escribir sobre las letras

3 Tipo

4 Curvatura

5 Entrada y salida

\ar [r]ˆ{f} a f //b

\ar [r]_{f} a

f //b

\ar [r]|{f} a f //b

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 39 / 80

(46)

Las flechas

Dentro de una xymatrix podemos introducir flechas con el comando \ar Admite varios modificadores

1 Destino

2 Etiqueta

3 TipoHay distintos tipos de base, cuerpos y cabezas de flecha

\ar @{<type>}[<hop>]

4 Curvatura

5 Entrada y salida

@{=>} a +3b

@{.>} a //b

@{:>} a +3b

@{˜>} a //b

@{-->} a //b

@{|->} a //b

(47)

Las flechas

Dentro de una xymatrix podemos introducir flechas con el comando \ar Admite varios modificadores

1 Destino

2 Etiqueta

3 Tipo

4 Curvatura Podemos curvar las flechas hacia arriba y hacia abajo, para evitar que se

corten, o solo para quede m´as estiloso \ar

@/<curve>/ [<hop>]

5 Entrada y salida

@/_/ a 66b

@/ˆ/ a ((b

@/_1mm/ a 22b

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 39 / 80

(48)

Las flechas

Dentro de una xymatrix podemos introducir flechas con el comando \ar Admite varios modificadores

1 Destino

2 Etiqueta

3 Tipo

4 Curvatura

5 Entrada y salidaSi queremos que la flecha salga desde una parte en concreto de la celda podemos especificarlo

\ar

@(<in>,<out>)[<hop>]

@(u,d)[r] a bLL

@(ur,dr)[] add b

(49)

Las flechas

Ejercicio

Escriba el siguiente diagrama:

A



f  !!

B _ //



C yy id

D

C´odigo (ejercicio3.tex)

$$

\xymatrix{

A \ar@/_2ex/[ddr] \ar[dr]|f \ar@/ˆ2ex/[drr] \\

& B \ar@{-->}[r] \ar@{ˆ(->}[d] & C\ar@(dr,ur)[]_{id} \\

& D }

$$

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 40 / 80

(50)

Las flechas

Ejercicio

Escriba el siguiente diagrama:

A



f  !!

B _ //



C yy id

D

C´odigo (ejercicio3.tex)

$$

\xymatrix{

A \ar@/_2ex/[ddr] \ar[dr]|f \ar@/ˆ2ex/[drr] \\

& B \ar@{-->}[r] \ar@{ˆ(->}[d] & C\ar@(dr,ur)[]_{id} \\

& D }

(51)

El paquete xy-pic y el paquete babel

El paquete babel entra en conflicto con @ as´ı que si queremos hacer buenos diagramas debemos desactivarlo. Empleando inputenc con utf8 no tendremos problemas con los acentos. Debemos cambiar los nombres de cap´ıtulos y secciones. Para ello \renewcommand

{<command>}{<new_name>}

\abstractname Abstract

\appendixname Appendix

\bibname Bibliography (report,book)

\chaptername Chapter (report,book)

\contentsname Contents

\figurename Figure (for captions)

\indexname Index

\listfigurename List of Figures

\listtablename List of Tables

\tablename Table (for caption)

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 41 / 80

(52)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo: Los teoremas se escriben en cursiva, mientras que las definiciones se escriben con fuente normal.

2 El nombre

3 La numeraci´on

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}{<name>}

(...)

\begin {document}

Hay tres estilos predefinidos:

plain Theorem 1.Theorem text.

definition Definition 1. Definition text.

remark Remark 1.Remark text.

(53)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo

2 El nombre: Debemos poner un nombre de entorno <env>, ya sea teorema (por ejemplo

<env>=teorema) un nombre para mostrar en el documento (por ejemplo

<name>=Teorema)

3 La numeraci´on

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}{<name>}

(...)

\begin {document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 42 / 80

(54)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo

2 El nombre

3 La numeraci´on: Podemos numerar los teoremas de diferentes maneras

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}{<name>}

(...)

\begin {document}

(55)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo

2 El nombre

3 La numeraci´on

a) Con su propio contador:

El contador se crea por defecto si no decimos nada m´as, y se nombra autom´aticamente como

<env>

b) Siguiendo la numeraci´on de otro teorema ya definido c) Supeditada a otro

contador, por ejemplo la secci´on.

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}{<name>}

(...)

\begin {document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 42 / 80

(56)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo

2 El nombre

3 La numeraci´on

a) Con su propio contador:

b) Siguiendo la numeraci´on de otro teorema ya definido

c) Supeditada a otro contador, por ejemplo la secci´on.

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}[<counter>]{<name>}

(...)

\begin {document}

(57)

Teoremas

El paquete amsthm

A la hora definir un teorema debemos tener en cuenta tres cosas

1 El estilo

2 El nombre

3 La numeraci´on

a) Con su propio contador:

b) Siguiendo la numeraci´on de otro teorema ya definido c) Supeditada a otro

contador, por ejemplo la secci´on. En este caso el contador de tipo a) lleva como predecesor el otro contador, y se resetea al cambiar el contador al que supedita

C´odigo

\documentclass (...)

\theoremstyle {<style>}

\newtheorem {<env>}{<name>}[<counter>]

(...)

\begin {document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 42 / 80

(58)

Teoremas

Ejemplo

Este es el aspecto de un teorema normal definido con el paquete amsthm.

C´odigo (ejemplo2.tex)

\documentclass{article}

\usepackage{amsthm}

\theoremstyle{plain}

\newtheorem{teorema}{Teorema}

\begin{document}

\begin{teorema}[Euclides]

No existe un primo mayor que el resto.

\end{teorema}

\end{document}

Teorema 1 (Euclides) . No existe un primo mayor que el resto.

(59)

Operadores matem´ aticos

Con el paquete amsmath se pueden definir operadores matem´aticos, como div o rot:

\DeclareMathOperator {\rot }{rot}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 44 / 80

(60)

Ejercicio

Escribir el siguiente documento LATEX

El teorema de la divergencia

Un estudiante 10 de abril de 2013

1. El teorema

El teorema de la divergencia de Gauss se enuncia de la siguiente manera Teorema 1.1. Dado ....

Demostraci´on. La prueba...

2. Ejercicios

Ejercicio 1. Este ejercicio

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 45 / 80

(61)

Soluci´ on

C´odigo

(ejercicio1.tex)

\documentclass{article}

\usepackage[spanish]{babel}

\usepackage[utf8]{inputenc}

\usepackage{amsthm}

\theoremstyle{plain}

\newtheorem{thm}{Teorema}[section]

\theoremstyle{definition}

\newtheorem{ex}{Ejercicio}

\title{El teorema de la divergencia}

\author{Un estudiante}

\begin{document}

\maketitle

C´odigo (ejemplo3.tex)

\section{El teorema}

El teorema de la divergencia de Gauss se enuncia de la siguiente manera

\begin{thm}

Dado ....

\end{thm}

\begin{proof}

La prueba...

\end{proof}

\section{Ejercicios}

\begin{ex}

Este ejercicio

\end{ex}

\end{document}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 46 / 80

(62)

Sesi´ on III

L

A

TEX como editor de texto

avanzado

(63)

Flotantes y su localizaci´ on

Los objetos con los que vamos a trabajar: figuras, tablas, etc... se conocen como flotantes.

Por defecto LATEX los coloca donde menos moleste: en el lugar del texto donde hemos colocado el c´odigo, al principio de la p´agina o al final de la p´agina.

Podemos especificar d´onde colocarlos mediante par´ametros optativos:

\begin {figure}[placement specifier]. Las opciones son las siguientes

Specifier Permission

h Place the float here (approximately at the same point it occurs in the source text) t Position at the top of the page.

b Position at the bottom of the page. p Put on a special page for floats only.

! Override internal parameters LaTeX uses for determining “good” float positions. H Places the float at precisely the location in the LaTeX code. Requires the float package.

Tambi´en se admiten cadena htb significa: int´entalo en su sitio, si no ponlo arriba y, si no, abajo.

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 48 / 80

(64)

Flotantes y su localizaci´ on

Los objetos con los que vamos a trabajar: figuras, tablas, etc... se conocen como flotantes.

Por defecto LATEX los coloca donde menos moleste: en el lugar del texto donde hemos colocado el c´odigo, al principio de la p´agina o al final de la p´agina.

Podemos especificar d´onde colocarlos mediante par´ametros optativos:

\begin {figure}[placement specifier].

Las opciones son las siguientes

Specifier Permission

h Place the float here (approximately at the same point it occurs in the source text) t Position at the top of the page.

b Position at the bottom of the page.

p Put on a special page for floats only.

! Override internal parameters LaTeX uses for determining “good” float positions.

H Places the float at precisely the location in the LaTeX code. Requires the float package.

Tambi´en se admiten cadena htb significa: int´entalo en su sitio, si no ponlo arriba y, si no, abajo.

(65)

Figuras

Para incluir im´agenes empleamos el paquete graphicx. Si empleamos el compilador pdflatex. Podemos emplear im´agenes .pdf, .png.

Tiene los siguientes par´ametros:

1 <path>Es la direcci´on del archivo a incluir. Lo mejor es escribirla relativa al directorio esto es<path>=archivo.pdf

2 <scale>

3 <caption>

C´odigo

\begin{figure}[h!]

\includegraphics [scale= <scale>]{<path>}

\caption {<caption>}

\end {figure}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 49 / 80

(66)

Figuras

Para incluir im´agenes empleamos el paquete graphicx. Si empleamos el compilador pdflatex. Podemos emplear im´agenes .pdf, .png.

Tiene los siguientes par´ametros:

1 <path>

2 <scale>Valor entre 0 y 1 al que escalar la figura.

3 <caption>

C´odigo

\begin{figure}[h!]

\includegraphics [scale=<scale>]{<path>}

\caption {<caption>}

\end {figure}

(67)

Figuras

Para incluir im´agenes empleamos el paquete graphicx. Si empleamos el compilador pdflatex. Podemos emplear im´agenes .pdf, .png.

Tiene los siguientes par´ametros:

1 <path>

2 <scale>

3 <caption>El contenido de

<caption> ser´a el pie de foto, es decir, aparecer´a Figura x:

caption

C´odigo

\begin{figure}[h!]

\includegraphics [scale= <scale>] {<path>}

\caption {<caption>}

\end {figure}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 49 / 80

(68)

Figura

Ejemplo

C´odigo

\documentclass{article}

\usepackage{graphicx}

\begin{document}

\begin{figure}

\centering

\includegraphics[scale=0.5]

{gauss.pdf}

\caption{Gauss}

\end{figure}

\end{document}

Figure 1: Gauss

(69)

Tablas

Las el entorno table es equivalente a figura, pero al generar el caption obtendremos Cuadro (como recomiendo la RAE).

En contenido de la tabla se introduce de manera similar a una matriz

1 <align>:

a) l: izquierda b) c: centrado c) r: derecha

2 &

3 |

4 \hline

C´odigo

\begin{tabular}{<align>| ... } cuadro1 & cuadro2 & ... \\

\hline\\

...

\end{tabular}

David G´omez-Castro (UCM) Introducci´on a LATEX 2ε Diciembre 2018 51 / 80

(70)

Tablas

Las el entorno table es equivalente a figura, pero al generar el caption obtendremos Cuadro (como recomiendo la RAE).

En contenido de la tabla se introduce de manera similar a una matriz

1 <align>:

2 & Separaci´on entre cuadros en la misma fila

3 |

4 \hline

C´odigo

\begin{tabular}{<align>| ... } cuadro1 & cuadro2 & ... \\

\hline\\

...

\end{tabular}

Referencias

Documento similar

In addition to regular polyhedron central configurations, the simplest spa- tial central configurations of the N –body problem are the ones known as pyramidal central

Assuming that every central configuration of the 4–body problem has an axis of symmetry when the four masses are equal, Llibre in [26] computed the planar central configurations of

The following result shows that the agreement between zeta-dimension and Haus- dorff dimension noticed in Examples 2.2 and 3.5 are instances of a more general phenomenon: Given

La consulta d’aquesta tesi queda condicionada a l’acceptació de les següents condicions d'ús: La difusió d’aquesta tesi per mitjà del servei TDX (www.tdx.cat) ha estat

The problem of forming motivation through the organization of activities is quite relevant, given the structural and functional relationship of these phenomena

Given the predictive power of our procedure, it is interesting to check whether the IBM Hamiltonian determined from the microscopic mean-field calculation can explain the

In the context of population dynamics, the phase space of the system is given by all the possible configurations the population can have. In the model proposed by Verhulst it is

Our central result is the construction of a driving field for which the corresponding quasienergy spectrum is given by the Riemann  function [10,11], or by a smoothed version of