##// END OF EJS Templates
somme support for utf-8 in latex...
somme support for utf-8 in latex This allow the use of some utf-8/unicode in the ipynb->latex conversion. tested in codecell comment and markdown. Most of the caracter with accent, and thins like squareroot symbol and so on find their way through until the .tex file, but pdlatex compilation only works out of the box only with accentuated letters

File last commit:

r7046:8598fc2d
r7046:8598fc2d
Show More
preamble.tex
98 lines | 3.0 KiB | application/x-tex | TexLexer
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 %% This is the automatic preamble used by IPython. Note that it does *not*
%% include a documentclass declaration, that is added at runtime to the overall
%% document.
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
Matthias BUSSONNIER
somme support for utf-8 in latex...
r7046 \usepackage{ucs}
\usepackage[utf8x]{inputenc}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673
Fernando Perez
Fix handling of enumerations
r6675 % needed for markdown enumerations to work
\usepackage{enumerate}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 % Slightly bigger margins than the latex defaults
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.5cm,rmargin=2.5cm}
% Define a few colors for use in code, links and cell shading
\usepackage{color}
\definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
\definecolor{darkgreen}{rgb}{.12,.54,.11}
\definecolor{myteal}{rgb}{.26, .44, .56}
Stefan van der Walt
Tweak spacing in LaTeX output.
r6679 \definecolor{gray}{gray}{0.45}
\definecolor{lightgray}{gray}{.95}
\definecolor{mediumgray}{gray}{.8}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 \definecolor{inputbackground}{rgb}{.95, .95, .85}
\definecolor{outputbackground}{rgb}{.95, .95, .95}
\definecolor{traceback}{rgb}{1, .95, .95}
% Framed environments for code cells (inputs, outputs, errors, ...). The
% various uses of \unskip (or not) at the end were fine-tuned by hand, so don't
% randomly change them unless you're sure of the effect it will have.
\usepackage{framed}
% remove extraneous vertical space in boxes
\setlength\fboxsep{0pt}
% codecell is the whole input+output set of blocks that a Code cell can
% generate.
\newenvironment{codecell}{%
Stefan van der Walt
Tweak spacing in LaTeX output.
r6679 \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
\MakeFramed{\vspace{-0.5em}\FrameRestore}}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 {\unskip\endMakeFramed}
\newenvironment{codeinput}{%
\def\FrameCommand{\colorbox{inputbackground}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}}
{\unskip\endMakeFramed}
\newenvironment{codeoutput}{%
\def\FrameCommand{\colorbox{outputbackground}}%
Stefan van der Walt
Tweak spacing in LaTeX output.
r6679 \vspace{-1.4em}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 \MakeFramed{\advance\hsize-\width \FrameRestore}}
{\unskip\medskip\endMakeFramed}
\newenvironment{traceback}{%
\def\FrameCommand{\colorbox{traceback}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}}
{\endMakeFramed}
% Use and configure listings package for nicely formatted code
Matthias BUSSONNIER
somme support for utf-8 in latex...
r7046 \usepackage{listingsutf8}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 \lstset{
language=python,
Matthias BUSSONNIER
somme support for utf-8 in latex...
r7046 inputencoding=utf8x,
extendedchars=\true,
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 aboveskip=\smallskipamount,
belowskip=\smallskipamount,
%xleftmargin=3mm,
breaklines=true,
basicstyle=\small \ttfamily,
showstringspaces=false,
keywordstyle=\color{blue}\bfseries,
commentstyle=\color{myteal},
stringstyle=\color{darkgreen},
identifierstyle=\color{darkorange},
}
Fernando Perez
Fix handling of enumerations
r6675 % The hyperref package gives us a pdf with properly built
% internal navigation ('pdf bookmarks' for the table of contents,
% internal cross-reference links, web links for URLs, etc.)
\usepackage{hyperref}
\hypersetup{
breaklinks=true, % so long urls are correctly broken across lines
colorlinks=true,
urlcolor=blue,
linkcolor=darkorange,
citecolor=darkgreen,
}
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 % hardcode size of all verbatim environments to be a bit smaller
\makeatletter
Stefan van der Walt
Tweak spacing in LaTeX output.
r6679 \g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
Fernando Perez
Add preamble support for fully self-contained output TeX files.
r6673 \makeatother
% Prevent overflowing lines due to urls and other hard-to-break entities.
\sloppy