##// END OF EJS Templates
Backport PR #4849: Various unicode fixes (mostly on Windows)...
Backport PR #4849: Various unicode fixes (mostly on Windows) There were warnings on startup of IPython, and the qtconsole and notebook could not be started at all if the user's home directory is unicode. Changes: - add `prefer_stream=True` flag to utils.encoding.getdefaultencoding, since the right answer is different for stream output and other things. - always encode args to Popen on Windows Python 2 - never add unicode to sys.path on Python 2 These should be backported for 1.2, and it would be great if some unicode-locale Windows users (@jstenar) could double check the sanity of the changes.

File last commit:

r11995:f39f574c
r14916:7cbbbbc4
Show More
latex_basic.tplx
270 lines | 7.1 KiB | text/plain | TextLexer
Matthias BUSSONNIER
lots of modification for latex
r9611 ((*- extends 'display_priority.tplx' -*))
Matthias BUSSONNIER
multiple env
r9609
damianavila
Redo of fixing templates structure.
r11770
Jonathan Frederic
Fixed errors after testing...
r11742 \nonstopmode
damianavila
Redo of fixing templates structure.
r11770 ((* block in_prompt *))
((* endblock in_prompt *))
Matthias BUSSONNIER
multiple env
r9609
damianavila
Redo of fixing templates structure.
r11770 ((* block output_prompt *))
((* endblock output_prompt *))
Matthias BUSSONNIER
multiple env
r9609
damianavila
Redo of fixing templates structure.
r11770 ((* block codecell *))
\begin{codecell}
((( super() )))
Matthias BUSSONNIER
start tex template
r9610 \end{codecell}
((* endblock *))
((* block input *))
\begin{codeinput}
\begin{lstlisting}
((( cell.input )))
\end{lstlisting}
\end{codeinput}
Matthias BUSSONNIER
multiple env
r9609 ((* endblock input *))
((= Those Two are for error displaying
even if the first one seem to do nothing,
it introduces a new line
=))
damianavila
Redo of fixing templates structure.
r11770
Matthias BUSSONNIER
fix latex base template :...
r9884 ((* block pyerr *))
\begin{traceback}
damianavila
Redo of fixing templates structure.
r11770 \begin{verbatim}
((( super() )))
Matthias BUSSONNIER
fix latex base template :...
r9884 \end{verbatim}
\end{traceback}
Matthias BUSSONNIER
multiple env
r9609 ((* endblock pyerr *))
((* block traceback_line *))
damianavila
Redo of fixing templates structure.
r11770 ((( line | indent | strip_ansi )))
((* endblock traceback_line *))
Matthias BUSSONNIER
multiple env
r9609 ((= .... =))
Matthias BUSSONNIER
lots of modification for latex
r9611 ((*- block output_group -*))
\begin{codeoutput}
((( super() )))
damianavila
Redo of fixing templates structure.
r11770 \end{codeoutput}
((* endblock *))
Matthias BUSSONNIER
lots of modification for latex
r9611
Matthias BUSSONNIER
test_file extractor
r9613 ((*- block data_png -*))
\begin{center}
MinRK
ensure filenames have posix-paths in latex on Windows
r11973 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{((( output.png_filename | posix_path )))}
Matthias BUSSONNIER
create configurable preprocessors
r9624 \par
\end{center}
((*- endblock -*))
Matthias BUSSONNIER
fix latex base template :...
r9884 ((*- block data_jpg -*))
\begin{center}
MinRK
ensure filenames have posix-paths in latex on Windows
r11973 \includegraphics[max size={0.7\textwidth}{0.9\textheight}]{((( output.jpeg_filename | posix_path )))}
Matthias BUSSONNIER
fix latex base template :...
r9884 \par
\end{center}
((*- endblock -*))
Matthias BUSSONNIER
create configurable preprocessors
r9624 ((*- block data_svg -*))
\begin{center}
MinRK
ensure filenames have posix-paths in latex on Windows
r11973 \includegraphics[width=0.7\textwidth]{((( output.svg_filename | posix_path )))}
Matthias BUSSONNIER
test_file extractor
r9613 \par
\end{center}
((*- endblock -*))
Matthias BUSSONNIER
lots of modification for latex
r9611
MinRK
add data_pdf block to latex templates
r11574 ((*- block data_pdf -*))
\begin{center}
MinRK
ensure filenames have posix-paths in latex on Windows
r11973 \includegraphics[width=0.7\textwidth]{((( output.pdf_filename | posix_path )))}
MinRK
add data_pdf block to latex templates
r11574 \par
\end{center}
((*- endblock -*))
Matthias BUSSONNIER
multiple env
r9609 ((* block pyout *))
damianavila
Redo of fixing templates structure.
r11770 ((* block data_priority scoped *))
((( super() )))
((* endblock *))
Matthias BUSSONNIER
multiple env
r9609 ((* endblock pyout *))
Matthias BUSSONNIER
lots of modification for latex
r9611 ((* block data_text *))
\begin{verbatim}
((( output.text )))
\end{verbatim}
((* endblock *))
Matthias BUSSONNIER
fix latex base template :...
r9884 ((* block data_latex -*))
jakobgager
Small latex mods: Escapes, Headings, Equations...
r10882 ((*- if output.latex.startswith('$'): -*)) \begin{equation*}
damianavila
Redo of fixing templates structure.
r11770 ((( output.latex | strip_dollars )))
jakobgager
Small latex mods: Escapes, Headings, Equations...
r10882 \end{equation*}
damianavila
Redo of fixing templates structure.
r11770 ((*- else -*))
((( output.latex )))
((*- endif *))
Matthias BUSSONNIER
fix latex base template :...
r9884 ((* endblock *))
Matthias BUSSONNIER
multiple env
r9609 ((* block stream *))
jakobgager
Convert ansi colors to latex markup
r10933 \begin{Verbatim}[commandchars=\\\{\}]
damianavila
Redo of fixing templates structure.
r11770 ((( output.text | ansi2latex )))
jakobgager
Convert ansi colors to latex markup
r10933 \end{Verbatim}
Matthias BUSSONNIER
multiple env
r9609 ((* endblock stream *))
damianavila
Redo of fixing templates structure.
r11770 ((* block markdowncell scoped *))
((( cell.source | markdown2latex )))
Matthias BUSSONNIER
multiple env
r9609 ((* endblock markdowncell *))
jakobgager
Small latex mods: Escapes, Headings, Equations...
r10882 ((* block headingcell scoped -*))
damianavila
Redo of fixing templates structure.
r11770 ((( ('#' * cell.level + cell.source) | replace('\n', ' ') | markdown2latex )))
Matthias BUSSONNIER
multiple env
r9609 ((* endblock headingcell *))
((* block rawcell scoped *))
Jonathan Frederic
Filter names cleanup
r11685 ((( cell.source | comment_lines )))
Matthias BUSSONNIER
multiple env
r9609 ((* endblock rawcell *))
((* block unknowncell scoped *))
damianavila
Redo of fixing templates structure.
r11770 unknown type ((( cell.type )))
Matthias BUSSONNIER
multiple env
r9609 ((* endblock unknowncell *))
Matthias BUSSONNIER
start tex template
r9610
Jonathan Frederic
Got both of the main template formats from sphinx rendering....
r9746 ((* block body *))
Matthias BUSSONNIER
fix latex base template :...
r9884 ((* block bodyBegin *))
\begin{document}
((* endblock bodyBegin *))
((( super() )))
Jonathan Frederic
Got both of the main template formats from sphinx rendering....
r9746
Matthias BUSSONNIER
fix latex base template :...
r9884 ((* block bodyEnd *))
\end{document}
((* endblock bodyEnd *))
Jonathan Frederic
Got both of the main template formats from sphinx rendering....
r9746 ((* endblock body *))
Matthias BUSSONNIER
start tex template
r9610
((* block header *))
%% This file was auto-generated by IPython.
%% Conversion from the original notebook file:
%%
\documentclass[11pt,english]{article}
%% 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}
Paul Ivanov
add grffile to the basic latex template
r11995 \usepackage{grffile}
Matthias BUSSONNIER
start tex template
r9610 \usepackage{ucs}
\usepackage[utf8x]{inputenc}
jakobgager
Use adjustbox to specify figure size in latex
r11243 % Scale down larger images
\usepackage[export]{adjustbox}
jakobgager
Convert ansi colors to latex markup
r10933 %fancy verbatim
\usepackage{fancyvrb}
Matthias BUSSONNIER
start tex template
r9610 % needed for markdown enumerations to work
\usepackage{enumerate}
% 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}
\definecolor{gray}{gray}{0.45}
\definecolor{lightgray}{gray}{.95}
\definecolor{mediumgray}{gray}{.8}
\definecolor{inputbackground}{rgb}{.95, .95, .85}
\definecolor{outputbackground}{rgb}{.95, .95, .95}
\definecolor{traceback}{rgb}{1, .95, .95}
jakobgager
Add missing color definintions to latex header
r10944 % new ansi colors
\definecolor{brown}{rgb}{0.54,0.27,0.07}
\definecolor{purple}{rgb}{0.5,0.0,0.5}
\definecolor{darkgray}{gray}{0.25}
\definecolor{lightred}{rgb}{1.0,0.39,0.28}
\definecolor{lightgreen}{rgb}{0.48,0.99,0.0}
\definecolor{lightblue}{rgb}{0.53,0.81,0.92}
\definecolor{lightpurple}{rgb}{0.87,0.63,0.87}
\definecolor{lightcyan}{rgb}{0.5,1.0,0.83}
Matthias BUSSONNIER
start tex template
r9610 % 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.
% TODO: unfortunately, it seems that using a framed codecell environment breaks
% the ability of the frames inside of it to be broken across pages. This
% causes at least the problem of having lots of empty space at the bottom of
% pages as new frames are moved to the next page, and if a single frame is too
% long to fit on a page, will completely stop latex from compiling the
% document. So unless we figure out a solution to this, we'll have to instead
% leave the codecell env. as empty. I'm keeping the original codecell
% definition here (a thin vertical bar) for reference, in case we find a
% solution to the page break issue.
%% \newenvironment{codecell}{%
%% \def\FrameCommand{\color{mediumgray} \vrule width 1pt \hspace{5pt}}%
%% \MakeFramed{\vspace{-0.5em}}}
%% {\unskip\endMakeFramed}
% For now, make this a no-op...
\newenvironment{codecell}{}
\newenvironment{codeinput}{%
\def\FrameCommand{\colorbox{inputbackground}}%
\MakeFramed{\advance\hsize-\width \FrameRestore}}
{\unskip\endMakeFramed}
\newenvironment{codeoutput}{%
\def\FrameCommand{\colorbox{outputbackground}}%
\vspace{-1.4em}
\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
\usepackage{listingsutf8}
\lstset{
language=python,
inputencoding=utf8x,
extendedchars=\true,
aboveskip=\smallskipamount,
belowskip=\smallskipamount,
xleftmargin=2mm,
breaklines=true,
basicstyle=\small \ttfamily,
showstringspaces=false,
keywordstyle=\color{blue}\bfseries,
commentstyle=\color{myteal},
stringstyle=\color{darkgreen},
identifierstyle=\color{darkorange},
columns=fullflexible, % tighter character kerning, like verb
}
% 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,
}
% hardcode size of all verbatim environments to be a bit smaller
\makeatletter
\g@addto@macro\@verbatim\small\topsep=0.5em\partopsep=0pt
\makeatother
% Prevent overflowing lines due to urls and other hard-to-break entities.
\sloppy
((* endblock *))