Skip to content

Instantly share code, notes, and snippets.

@rbonvall
Created September 24, 2012 22:30
Show Gist options
  • Select an option

  • Save rbonvall/3778850 to your computer and use it in GitHub Desktop.

Select an option

Save rbonvall/3778850 to your computer and use it in GitHub Desktop.
XeLaTeX test
\documentclass{article}
\usepackage{mathpazo}
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{fancyvrb}
\usepackage{polyglossia}
\setromanfont{TeXGyrePagella}
\setmonofont[Scale=MatchLowercase]{DejaVu Sans Mono}
\setdefaultlanguage{spanish}
%\setsansfont{DejaVu Sans}
%\setmathfont{Asana Math}
\lstset{basicstyle=\tt}
\lstset{language=fortran}
\lstset{frame=tb}
\lstset{backgroundcolor=\color{blue!80!green!20}}
\lstdefinestyle{console}{%
backgroundcolor=\color{gray!80},%
moredelim=[is][\color{red!80!black}]{`}{`},%
frame=single,%
}
\title{XeLaTeX}
\author{Roberto Bonvallet}
\begin{document}
\maketitle
Testing XeLaTeX!
\[
\Delta = b^2 - 4ac + \sum_k \frac{x^k}{k!}
\]
El polinomio \(p(x) = 1 + 2x + x^2\) tiene una raíz: \(x_0 = -1\).
Greek: τεχ.
\begin{verbatim}
₀ ₁ ₂ ₃
┌───┬───┬───┬───┐
│ ♠ │ ♥ │ ♦ │ ♣ │
┝━━━┿━━━┿━━━┿━━━┥
└───┴───┴───┴───┘
Lala un dos tres.
Δ = β² - 4αξ
↑ ↑ ↑↑
\end{verbatim}
La función \texttt{factorial} puede ser implementada de la siguiente manera:
\begin{lstlisting}
function factorial(n) result(f)
integer, intent(in) :: n
integer :: f, i
f = 1
do i = 1, n
f = f * i
end do
end function factorial
\end{lstlisting}
La función recibe un parámetro \lstinline!n! de tipo \lstinline!integer!.
Al ejecutar el programa en la consola, uno obtiene lo siguiente:
\begin{lstlisting}[style=console]
Ingrese un valor: `10`
El factorial de 10 es 3628800
\end{lstlisting}
\end{document}
@cmaureir
Copy link

Hay que instalar alguna fuente en especial?

neXus~/tmp >>xelatex b.te
...
Transcript written on mfput.log.
grep: TeXGyrePagella.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input TeXGyrePagella' failed to make TeXGyrePagella.tfm.
kpathsea: Appending font creation commands to missfont.log.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "TeXGyrePagella" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H .
!...............................................

l.10 \setromanfont{TeXGyrePagella}

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment