Skip to content

Instantly share code, notes, and snippets.

@vermiculus
Last active November 24, 2015 20:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vermiculus/ee6335422ebed7342805 to your computer and use it in GitHub Desktop.
Save vermiculus/ee6335422ebed7342805 to your computer and use it in GitHub Desktop.
\documentclass{report}
\makeatletter
\def\lcr@@set#1{\lcr@@@set{#1}}
\long\def\lcr@@@set#1#2{%
\expandafter\def\csname lcr@#1\endcsname{#2}}
\def\lcr@@get#1{\csname lcr@#1\endcsname}
\def\lcr@@new@format#1#2{%
\expandafter\def\csname #1Format\endcsname{#2}
\expandafter\def\csname #1\endcsname##1{%
\begingroup\csname #1Format\endcsname##1\endgroup}}
\let\Get\lcr@@get
\let\Set\lcr@@set
\let\DeclareFormat\lcr@@new@format
\makeatother
\Set{id}{\$TCSU\_LCR\_12345}
\Set{design-part}{TEST-DESIGN\_Part}
\Set{title}{%
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris.
Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.}
\Set{author.name}{A.\,U.\,Thor}
\Set{author.email}{fake@email.1}
\Set{assigned.name}{Prof.\,Drofnats}
\Set{assigned.email}{fake@email.2}
\Set{description}{\lipsum[1]}
\Set{recreation}{\lipsum[2]}
\Set{comments}{\lipsum[3]}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{lastpage}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{array}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{tikz}
\usetikzlibrary{fadings}
\usepackage[
letterpaper,
headheight = 4in,
headsep = 4ex,
margin = {{1cm, \dimexpr 3cm+4ex}},
]{geometry}
\lhead{\hspace*{7.5mm}\footnotesize
\begin{tabular}[b]{>{\LabelFormat}rl>{\EmailFormat}l}
Identifier & \multicolumn{2}{l}{\Identifier{\Get{id}}} \\
Design Part & \multicolumn{2}{l}{\Identifier{\Get{design-part}}} \\
Author & \Get{author.name} & \Get{author.email} \\
Assigned To & \Get{assigned.name} & \Get{assigned.email} \\
Title & \multicolumn{2}{p{.65\textwidth}}{\FadeAfter{.8\linewidth}{\Get{title}}} \\
\end{tabular}}
\rhead{\includegraphics[width=1in]{example-image-a}}
\cfoot{\thepage\ of \pageref{LastPage}}
\pagestyle{fancy}
\SetLabelAlign{parright}{\strut
\smash{\parbox[t]\labelwidth
{\raggedleft#1}}}
\setlist[description]{
labelwidth = 1in,
align = parright,
labelsep = 1em,
leftmargin = \dimexpr 1in+1em,
rightmargin = 1in,
}
\tikzfading[name=fade left,
left color=transparent!100,
right color=transparent!0]
\newcommand{\FadeAfter}[2]{%
\minipage{\linewidth}%
\begin{tikzpicture}
\node[inner sep=0pt,inner ysep=2pt,outer sep=0pt,clip] (A) {\makebox[\linewidth][l]{#2}};
\fill[white,path fading=fade left] ([xshift={#1}]A.south west) rectangle ([xshift={1pt}]A.north east);
\end{tikzpicture}%
\endminipage
}
\DeclareFormat{Email}{\ttfamily}
\DeclareFormat{Label}{\sffamily\color{gray}}
\DeclareFormat{Identifier}{\ttfamily}
\usepackage{mwe}
\begin{document}
\begin{description}
\item[Full Title]
\Get{title}
\item[Description]
\Get{description}
\item[Recreation]
\Get{recreation}
\item[Comments]
\Get{comments}
\end{description}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment