~~stoggle_buttons~~
====== LaTeX ======
LATEX
[[http://detexify.kirelabs.org/classify.html|Detexify LaTeX]]
[[https://en.wikibooks.org/wiki/LaTeX| LaTeX wikibook]]
===== trucos =====
\bigskip % Suele funcionar cuando no funciona \\
\pagenumbering{gobble} % No hay num de pag
\begin{minipage}[b]{0.45\linewidth}
.
.
.
\end{minipage} % IMPORTANTE: no puede haber ningún espacio aquí
\begin{minipage}[b]{0.45\linewidth}
.
.
.
\end{minipage}
$\xrightarrow[\text{world}]{\text{hello}}$ % flechas con hello arriba y world abajo
$\xRightarrow[\text{world}]{\text{hello}}$ % lo mismo con flecha doble
\uncover para quitar la transparencia del índice en beamer
===== Diagramas con dia =====
Diagramas con Dia: [[http://lightonphiri.org/blog/latex-consistent-diagrams-using-dia]]
Luego también se puede usar [[https://www.unicodeit.net/]] y exportar a "eps using Pango fonts" (eps parece ser que es más peer-review friendly)
===== Instalación Linux =====
Archivos .tex
En Linux, hace falta instalar ''texlive'' y ''pdflatex''. Para compilar un .tex:
$ texi2pdf 1.tex --clean
===== Estructura de un archivo de Latex =====
\documentclass{article}
\begin{document}
\begin{}
\end{}
\end{document}
Preámbulo actual:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish, es-nodecimaldot]{babel}
\usepackage{amsmath}
\usepackage{braket}
\usepackage[bitstream-charter]{mathdesign}
\usepackage{graphicx}
\graphicspath{{img/}}
\usepackage[top=1.0in, bottom=1.0in, left=0.85in, right=0.85in]{geometry}
\usepackage[citecolor=blue,linkcolor=black,colorlinks=true]{hyperref}
\setlength\parindent{0pt}
\setlength{\columnsep}{1.5cm}
\newcommand{\tmop}[1]{\ensuremath{\operatorname{#1}}}
\newcommand{\grad}{$^{\circ}$}
\begin{document}
\title{}
\author{}
\date{}
\maketitle
Formato para hacer un libro con tabla de contenidos
documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[hidelinks]{hyperref}
\usepackage{makeidx}
\makeindex
\usepackage{graphicx}
\graphicspath{ {img/} }
\begin{document}
\title{}
\author{}
\date{}
\maketitle
\pagenumbering{roman}
\newpage
\renewcommand*\contentsname{Índice}
\tableofcontents
\newpage
\pagenumbering{arabic}
\end{document}
\[[[sub]sub]sub]section{text}
\[sub]paragraph{text}
\usepackage{PackageName}
===== Ecuaciones =====
$ecuacion$ si está dentro de un texto
\begin{equation} \label{eq:foobar}
ecuaciones
\end{equation}
Lo de arriba se puede citar como la ecuación \eqref{eq:foobar}
\begin{equation*} \end{equation*} Así no pone un número a la ecuación
\left( \left[ \right] \right) hace los (), [] del tamaño de las ecuaciones
\frac{a}{b}
\log_a{b}
\sqrt[n]{x} = raiz n-esima de x
\pm = +-
\simeq = ~=
\sim = ~
\dot = ·
\int^a_b f(x) dx = integral de f(x)dx entre a y b
\int_S = integral en la superficie S
\oint_C = integral de contorno (con el circulito)
===== Matrices =====
\begin{[b|p|v|ø]matrix}
1 & 0 \\
0 & 1
\end{[b|p|v|ø]matrix}
Esto hace una matriz unidad 2x2 con **b**rackets [], **p**aréntesis (), lineas **v**erticales ||, o nada
\cdots ... \ddtos .
\vdots .
. .
.
.
===== Vectores =====
\vec{p} dentro de equation*
$\mathbf{v}$ dentro de texto
===== Formato =====
\usepackage[margin = 1.5in]{geometry}
``entre comillas''
Espacios
\, < \: < \; cada uno es mayor
\\ = cambio de parrafo, \\* = cambio de linea
\linebreak, \newline, \newpage
\ragged[left|right]{texto} = texto alineado derecha izquierda
\centering{text} = texto alineado centro
\begin{verbatim} Exactamente lo que ponga aqui \end{verbatim}
% comentario
Para poner unidades,
$v= 10\text{ m/s}$, $v= 10\mathrm{ m/s}$
o poner espacios
$v = 10\:m/s$
\usepackage{multicol}
\begin{multicols}{2}
Texto en 2 columnas
\end{multicols}
==== Fuentes ====
Para instalar las fuentes en Linux:
# apt-get install texlive-fonts-recommended texlive-fonts-extra
[[http://www.tug.dk/FontCatalogue/mathfonts.html|Fonts with math support]]
Charter font (parecida a una Times)
\usepackage[bitstream-charter]{mathdesign}
%\usepackage[T1]{fontenc} (no hace falta)
Palatino Linotype
\usepackage{pxfonts, newpxmath}
\texttt{Fuente monoespaciada para codigo}
\textbf{bold}, \textit{italics}
===== Imágenes =====
\includegraphics[width = \linewidth]{foo.jpg}
\includegraphics[scale = 0.5]{bar.jpg}
\caption{Descripcion de la foto}
\label{fig:foo}
.
.
.
Como vemos en la figura \ref{fig:foo}
\includegraphics[width=\linewidth, trim= left bottom right top, clip[=true]]
Para alinear imágenes:
\usepackage[export]{adjustbox}
.
.
.
\includegraphics[width=\linewidth, "[right|left|right]"]
===== Hyperref =====
\usepackage[hidelinks]{hyperref}
Si se pone un \label{nombre} despues de \begin{equation} y se incluye hyperref, cuando se pone \eqref{nombre},
hyperref hace los links automáticamente
Hyperref conviene colocarlo al final de todos los ''usepackage'', puede causar problemas junto con otros paquetes en caso contrario.
===== Español =====
Para usar tildes y ñ normalmente:
\usepackage[utf8]{inputenc}
\'a = á
?` = ¿
!` = ¡
\~n = ñ
====== Lilypond ======
\include "lilypond-book-preamble.ly"
\paper {
#(define dump-extents #t)
indent = 0\mm
line-width = 160\mm
force-assignment = #""
line-width = #(- line-width (* mm 3.000000))
}
Genera un montón de basura al compilar a png.
$ lilypond --png -dresolution=200 li.ly
Genera
li-1.eps
li.eps
li.ly
li.png
li-systems.count
li-systems.tex
li-systems.texi
function lily2png {
file=${1%.*};
lilypond --png -dresolution=200 $1 && rm -f "$file"-1.eps "$file".eps "$file"-systems.count "$file"-systems.tex "$file"-systems.texi && echo "Eliminando archivos auxiliares...";
}
function lytex2pdf {
rand=`cat /dev/urandom | tr -cd 'a-f0-9' | head -c 8`
file=${1%.*};
mkdir $rand && lilypond-book --output=lilyout --pdf $1 && cd lilyout && texi2pdf --clean "$file".tex && mv "$file".pdf ../ && cd .. && rm -rf $rand;
}