texmf: moved old yasnippet to texmf tree. Needs refactoring.

master
Pierre Neidhardt 2014-03-10 19:52:36 +01:00
parent b2a077508e
commit 20e602b6db
5 changed files with 443 additions and 0 deletions

307
.texmf/tex/latex/letter.tex Normal file
View File

@ -0,0 +1,307 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage[scale=0.8]{geometry}
\usepackage{lmodern}
\usepackage{marvosym}
\usepackage{textcomp}
\DeclareUnicodeCharacter{20AC}{\EUR{}}
\DeclareUnicodeCharacter{2264}{\leqslant}
\DeclareUnicodeCharacter{2265}{\geqslant}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%==============================================================================
%% Localization
%%==============================================================================
\def\locale{en}
%% Language macros.
\usepackage{ifthen}
\def\localedef#1#2{
\ifthenelse{\equal{\locale}{#1}}{
\usepackage[#2]{babel}
\expandafter\def\csname#1\endcsname ##1{##1}
}{
\expandafter\def\csname#1\endcsname ##1{}}
}
%% Supported locales: en, fr.
\localedef{en}{english}
\localedef{fr}{frenchb}
%%==============================================================================
%% Personal Information
%%==============================================================================
\def\firstname{Pierre}
\def\familyname{Neidhardt}
\def\street{}
\def\postcode{}
\def\city{}
\def\country{}
\def\mobile{\en{(+00) }00 00 00}
\def\phone{\en{(+00) }00 00 00}
\def\mail{}
% \def\institute{} %% Not used.
%%==============================================================================
%% Recipient Information
%%==============================================================================
%% Recipient gender. Can be male, female, org.
\def\gender{${1:male}}
%% Recipient
\def\recipientfirstname{${2:Firstname}}
\def\recipientfamilyname{${3:Familyname}}
\def\recipientinstitute{${4:Institute}}
\def\recipientstreet{${5:Street}}
\def\recipientcity{${6:City}}
\def\recipientpostcode{${7:Postcode}}
%%==============================================================================
%% Subject
%%==============================================================================
\def\subject{${9:Subject}}
%%==============================================================================
%% PDF Metadata
%%==============================================================================
\def\FileAuthor{\firstname{} \familyname}
\def\FileTitle{Letter}
\def\FileSubject{\subject{}}
% \def\FileKeyWords{\firstname{} \familyname, letter}
%%==============================================================================
%% Packages
%%==============================================================================
% \usepackage{lipsum}
\usepackage[svgname]{xcolor}
\usepackage{eukdate}
\usepackage{needspace}
\usepackage{xspace}
%% Compilation options
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex]{graphicx}
\else
\usepackage[dvips]{graphicx}
\fi
%%==============================================================================
%% General options
%%==============================================================================
%% print if not empty
\def\pine#1{\def\test{#1}\ifx\test\empty\relax\else #1\fi}
%% print #2 if not empty.
\def\pinex#1#2{\ifx#1\empty\relax\else #2\fi}
%% Gender commands.
\def\genderdef#1{
\ifthenelse{\equal{\gender}{#1}}{
\expandafter\def\csname#1\endcsname ##1{##1}
}{
\expandafter\def\csname#1\endcsname ##1{}}
}
\genderdef{male}
\genderdef{female}
\genderdef{org}
\def\civility{%
\en{\male{M.}\female{Mrs.}}%
\fr{\male{Monsieur}\female{Madame}\org{Madame, Monsieur}}%
}
%% Greetings toggle.
\def\greetings #1{}
\ifthenelse{
\equal{\gender}{org}
}{}{\def\greetings #1{#1}}
%% Day-of-week translation
\makeatletter
\fr{
\renewcommand\weekday{%
\ifcase\theeuk@date Samedi\or Dimanche\or Lundi\or
Mardi\or Mercredi\or Jeudi\or Vendredi\fi}
\newcommand\weekdaylower{%
\ifcase\theeuk@date samedi\or dimanche\or lundi\or
mardi\or mercredi\or jeudi\or vendredi\fi}
}
\makeatother
%% Layout
\usepackage[scale=0.8]{geometry}
% \en{\setlength{\parindent}{0pt}}
\fr{
\setlength{\parindent}{4ex}
}
\addtolength{\parskip}{6pt}
%% Width of the minipage used to display parts of text on the right.
\newlength{\mpwidth}
\addtolength{\mpwidth}{0.4\textwidth}
%% Remove page number
\pagestyle{empty}
%% Fonts
\renewcommand{\familydefault}{\sfdefault}
%% \let\emphtemp\emph
%% \renewcommand{\emph}[1]{{\rm\emphtemp{#1}}}
\let\latextemp\LaTeX
\renewcommand{\LaTeX}{{\rm \latextemp}}
\let\textemp\TeX
\renewcommand{\TeX}{{\rm \textemp}}
%% PDF Metadata
\ifpdf
\usepackage[]{hyperref}
\hypersetup{
pdfauthor = \FileAuthor,
pdftitle = \FileTitle,
pdfsubject = \FileSubject,
%% pdfkeywords = \FileKeyWords,
pdfcreator = \LaTeX,
pdfproducer = \LaTeX,
pdftex,
pdfborder=0,
breaklinks,
baseurl=http://,
pdfpagemode=None,
pdfstartview=XYZ,
pdfstartpage=1,
colorlinks=true,
urlcolor=black
}
\else
\usepackage[dvips]{hyperref}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%==============================================================================
%% Personal particulars
%%==============================================================================
\en{\hfill}
\begin{minipage}{\mpwidth}
\edef\fullname{\firstname{} \familyname{}}
\pinex{\fullname}{\textbf{\fullname}
\vspace{0.5em}\\\\
}
\small\itshape%
\pinex{\street}{\street \\\\}
\pinex{\city}{\postcode{} \city\pinex{\country}{ -- \country{}}
\vspace{0.5em}\\\\
}
\pinex{\mobile}{\Mobilefone~\mobile \\\\}
\pinex{\phone}{\Telefon~\phone \\\\}
\pinex{\mail}{\Letter~\href{mailto:\mail}{\mail}}
\end{minipage}
\vspace{\baselineskip}
%%==============================================================================
%% Recipient particulars
%%==============================================================================
\en{\noindent}%
\fr{\hfill}%
\begin{minipage}{\mpwidth}
\edef\recipientfullname{\recipientfirstname{} \recipientfamilyname}
\pinex{\recipientfullname}{\textbf{\recipientfullname}\\\\[0.5\baselineskip]}
\pinex{\recipientinstitute}{\recipientinstitute{}\\\\[0.5\baselineskip]}
\pinex{\recipientcity}{
{\small\itshape
\recipientstreet{} \\\\
\pine{\recipientpostcode} \recipientcity{} \\\\
}
}
\end{minipage}
%%==============================================================================
%% Date
%%==============================================================================
\vfill
\vspace{1em}
\hfill
\begin{minipage}{\mpwidth}
\en{\today}
\fr{\city, le \weekdaylower\ \today}
\end{minipage}\\\\
%%==============================================================================
%% Object
%%==============================================================================
\pinex{\subject}{
\noindent
\textbf{\en{Object}\fr{Objet}~:}
\subject{}.
\vspace{1\baselineskip}
}
%%==============================================================================
%% Content
%%==============================================================================
\greetings{
\en{Dear}\fr{\male{Cher}\female{Chère}} \civility{} \recipientfamilyname,
}
\noindent
$0
Common blah.
I thank you for your consideration; I am looking forward to hearing from you soon!
%%==============================================================================
%% Closing
%%==============================================================================
\vfill
\en{
Best regards.
%% Yours sincerely,
}
\fr{
%% Cordialement,
Veuillez agréer, \civility{}, l'expression de mes sentiments les meilleurs.
}
\vspace{\baselineskip}
\hfill
\begin{minipage}{\mpwidth}
\textbf{\firstname\ \familyname}\newline
%\includegraphics[scale=0.75]{signature_blue}
\end{minipage}
%%==============================================================================
%% P.S. & Attachment
%%==============================================================================
\vfill
\noindent{
\scriptsize
\emph{\fr{Pièce(s) joint(es)~:}\en{Attachment:}}
Curriculum Vitæ
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1
.texmf/tex/latex/pie.tex Normal file
View File

@ -0,0 +1 @@
\piechart{color}{scale}{value1/label1, value2/label2, ...}

View File

@ -0,0 +1,77 @@
% pie chart generator
\newcounter{pieSlicePercentage}
\newcounter{pieCounterCurrent}
\newcounter{pieCounterNext}
\newcounter{pieCounterTotal}
\newcommand{\pieslice}[3]{
\pgfmathparse{0.5*#1+0.5*#2}
\let\midangle\pgfmathresult
\setcounter{pieSlicePercentage}{\p*100/\thepieCounterTotal}
% slice
\draw[thick,fill=#3!\thepieSlicePercentage] (0,0) -- (#1:1) arc (#1:#2:1) -- cycle;
}
\newcommand{\pieslicelabel}[3]{
\pgfmathparse{0.5*#1+0.5*#2}
\let\midangle\pgfmathresult
\setcounter{pieSlicePercentage}{\p*100/\thepieCounterTotal}
% Outer label.
\pgfmathparse{min((#2-#1-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
\pgfmathparse{max(\temp,-0.5) + 1.55}
\let\outerpos\pgfmathresult
\node at (\midangle:\outerpos) {\textbf{#3}};
% Inner label.
\pgfmathparse{min((#2-#1-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
\pgfmathparse{max(\temp,-0.5) + 0.8}
\let\innerpos\pgfmathresult
\node at (\midangle:\innerpos) {\thepieSlicePercentage \%};
}
\newcommand{\piechart}[3]{
\setcounter{pieCounterCurrent}{0}
\setcounter{pieCounterNext}{0}
\setcounter{pieCounterTotal}{0}
\begin{center}
\begin{tikzpicture}[scale=#2]
%% Get the total to turn the values into percentages.
\foreach \p/\t in {#3} {
\setcounter{pieCounterTotal}{\thepieCounterTotal+\p}
}
%% Draw the slices.
\foreach \p/\t in {#3} {
\setcounter{pieCounterCurrent}{\value{pieCounterNext}}
\addtocounter{pieCounterNext}{\p}
\pieslice{\thepieCounterCurrent/\thepieCounterTotal*360}
{\thepieCounterNext/\thepieCounterTotal*360}
{#1}
}
\setcounter{pieCounterCurrent}{0}
\setcounter{pieCounterNext}{0}
%% Write the labels.
\foreach \p/\t in {#3}{
\setcounter{pieCounterCurrent}{\value{pieCounterNext}}
\addtocounter{pieCounterNext}{\p}
\pieslicelabel{\thepieCounterCurrent/\thepieCounterTotal*360}
{\thepieCounterNext/\thepieCounterTotal*360}
{\t}
}
\end{tikzpicture}
\end{center}
}

View File

@ -0,0 +1,4 @@
\\plottype{plotname}%
{abscissa legend}
{ordinate legend}

View File

@ -0,0 +1,54 @@
% name: plot generator
\newcommand{\\${1}}[7]{
\begin{figure}[h!]
\caption{#1}
\begin{center}
\begin{tikzpicture}[scale=0.5,x=1cm,y=0.15cm]
%% User parameters.
\def\xmin{0}
\def\xmax{10}
\def\ymin{0}
\def\ymax{60}
\def\xstep{1}
\def\ystep{10}
%% Grid
\draw[style=help lines, ystep=\ystep, xstep=\xstep] (\xmin,\ymin) grid
(\xmax,\ymax);
%% Axes
\draw[->] (\xmin,\ymin) -- (\xmax+0.5*\xstep,\ymin)
node[below,yshift=-1em] {#2};
\draw[->] (\xmin,\ymin) -- (\xmin,\ymax+0.5*\ystep)
node[above] {#3};
%% xticks and yticks
\foreach \x in {\xmin,\xstep,...,\xmax}
\node at (\x, \ymin) [below] {\x};
\foreach \y in {\ymin,\ystep,...,\ymax}
\node at (\xmin,\y) [left] {\y};
%% DATA
%% Example from file.
%% Smooth the curve and mark the data point with a dot.
%% Data should be stored as
%% x1 y1
%% x2 y2
% \draw[color=blue]
% plot[smooth,mark=*,mark size=1pt, id=iter_sorted]
% file {#5}
% node [right] {#4};
%% Example trendline
%% \draw[color=orange,domain=\xmin+\xstep:\xmax]
%% plot[smooth, raw gnuplot, id=trend3]
%% function{f(x)=a*x*log(x)+b; fit f(x) '#5' via a,b; plot f(x)}
%% node [right,yshift=1em] {$\alpha_1 \cdot n\cdot \log(n) + \beta_1$};
$0
\end{tikzpicture}
\end{center}
\end{figure}
}