Skip to content

Instantly share code, notes, and snippets.

@vermiculus
Last active August 29, 2015 14:15
Show Gist options
  • Save vermiculus/35ea0838fc165de6877a to your computer and use it in GitHub Desktop.
Save vermiculus/35ea0838fc165de6877a to your computer and use it in GitHub Desktop.
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass
{note-verbale}
{2015/02/10}
{1}
{Class for enbassy notes}
\LoadClass[12pt]{article}
\RequirePackage{xparse}
\RequirePackage [ margin = 1in ] { geometry }
\RequirePackage { graphicx }
\RequirePackage { textcomp }
\RequirePackage { datetime }
\RequirePackage { fancyhdr }
\pagestyle{fancy}
\renewcommand\headrulewidth{0pt}
\fancyhf{}
\rhead{
Continuation~ of~ Note~ \textnumero\nobreakspace
\int_use:N \g_noteverbale_date_day_int
\slash
\int_use:N \g_noteverbale_date_month_int
\slash
\int_use:N \g_noteverbale_date_year_int
}
\cs_new:Npn \noteverbale_parse_date:nNNN
#1 #2 #3 #4
{
\noteverbale_parse_date_internal:nnnNNN
#1 \q_stop: #2 #3 #4
}
\cs_new:Npn \noteverbale_parse_date_internal:nnnNNN
#1-#2-#3 \q_stop: #4 #5 #6
{
\int_set:Nn #4 {#1}
\int_set:Nn #5 {#2}
\int_set:Nn #6 {#3}
}
\tl_new:N \g_noteverbale_city_tl
\tl_new:N \g_noteverbale_country_tl
\int_new:N \g_noteverbale_date_month_int
\int_new:N \g_noteverbale_date_day_int
\int_new:N \g_noteverbale_date_year_int
\tl_new:N \g_noteverbale_seal_tl
\keys_define:nn { note-verbale } {
city .tl_set:N = \g_noteverbale_city_tl,
country .tl_set:N = \g_noteverbale_country_tl,
date .code:n = {
\noteverbale_parse_date:nNNN
{#1}
\g_noteverbale_date_year_int
\g_noteverbale_date_month_int
\g_noteverbale_date_day_int
},
seal .tl_set:N = \g_noteverbale_seal_tl,
city .value_required:,
country .value_required:,
month .value_required:,
day .value_required:,
seal .default:n = { example-image-a },
% Customize the above to provide a reasonable default
}
\NewDocumentCommand \Information { m } {
\keys_set:nn { note-verbale } { #1 }
}
\RenewDocumentCommand \maketitle { } {
\thispagestyle{empty}
\begin{minipage}{.25\textwidth}
\includegraphics [
width = \textwidth,
] {
\g_noteverbale_seal_tl
}
\end{minipage}
\hfill
\begin{minipage}{.6\textwidth}
\color{blue}
\sffamily
\centering
EMBAIXADA~ DO~ BRASIL~ --~ EMBASSY~ OF~ BRAZIL
\par\vspace{1ex}
\tl_use:N \g_noteverbale_city_tl
\par\vspace{1ex}
NOME~ DO~ PA\'IS~ --~
\tl_use:N \g_noteverbale_country_tl
\end{minipage}
\par\vspace*{1cm}
Note~ \textnumero\nobreakspace
\int_use:N \g_noteverbale_date_day_int
\slash
\int_use:N \g_noteverbale_date_month_int
\slash
\int_use:N \g_noteverbale_date_year_int
\par\vspace*{1cm}
The~ Embassy~ of~ Brazil~ in~
\tl_use:N \g_noteverbale_city_tl {}~
presents~ its~ compliments~ to~ the~ Ministry~ of~ Foreign~ Affairs~
and~ has~ the~ honour~ to
\par
}
\setlength\parskip{2ex}
\setlength\parindent{.5in}
\AtEndDocument{
\par
The~ Embassy~ of~ Brazil~ avails~ itself~ of~ this~ opportunity~ to~
renew~ to~ the~ Ministry~ of~ Foreign~ Affaris~ the~ assurances~ of~
its~ highest~ consideration.
\par
\tl_use:N \g_noteverbale_city_tl,~
\shortmonthname [
\int_use:N \g_noteverbale_date_month_int
]
\nobreakspace
\int_use:N \g_noteverbale_date_day_int,~
\int_use:N \g_noteverbale_date_year_int
}
\documentclass{note-verbale}
\Information{
seal = example-image-a,
city = City of Sans Seriffe,
country = Denmark,
date = 2015-02-10,
}
\usepackage{mwe}
\begin{document}
\maketitle
\lipsum
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment