TCT-Law/craftconstitution.cls

141 lines
3.5 KiB
OpenEdge ABL
Raw Normal View History

2021-03-02 17:29:25 +00:00
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{craftlaw}[CraftLaw Constitution Class for an extra fancy print]
\LoadClass[a4paper,8pt,oneside]{article}
\RequirePackage[left=2cm, right=5cm, top=2cm]{geometry}
\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage{blindtext}
\RequirePackage{fancyhdr}
\RequirePackage{titling}
\RequirePackage{tikz}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{needspace}
% Margins
%\RequirePackage[inner=5cm,outer=1.5cm,bottom=3cm,marginparsep=6mm]{geometry}
%\setlength{\marginparwidth}{2.8cm}
%\reversemarginpar
\let\oldmarginpar\marginpar
\renewcommand{\marginpar}[2][rectangle,fill=white,text=black,text width=3cm]{
\oldmarginpar{
\hspace{50pt}\scriptsize \tikz \node at (0,0) [#1]{\textbf{#2}};}
}
% Indent
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\newcommand{\articleindent}{\leavevmode{\parindent=3em\indent}}
\setlist[enumerate,1]{leftmargin=1.5em,topsep=-1ex,itemsep=-1ex,partopsep=1ex,parsep=1ex,style=sameline}
\setlist[enumerate,2]{leftmargin=1.5em,topsep=-1ex,itemsep=-1ex,partopsep=1ex,parsep=1ex,style=sameline}
\setenumerate[0]{label=-\arabic*.}
% General Data
\date{\today}
\newcommand{\setheader}[1]{}
% New title layout
\newcommand{\settitle}[1]{%
\noindent%
\textbf{\large\fontfamily{phv}\fontseries{b}%
\selectfont #1}%
\medskip%
\fancyhead[RE,LO]{#1}%
}
% Introduction
\newcommand{\introduction}[1]{%
\bigskip%
\vbox{%
Preamble:\medskip%
\noindent{#1}%
}%
}
% About Articles
\newcounter{BookCounter}
\newcounter{TitleCounter}[BookCounter]
\newcounter{ChapterCounter}[TitleCounter]
\newcounter{ParagraphCounter}[ChapterCounter]
\newcounter{SubParagraphCounter}[ParagraphCounter]
\newcounter{ArticleCounter}[BookCounter]
\newcounter{ArticleSubCounter}[ArticleCounter]
\newcommand{\book}[1]{%
\newpage%
\stepcounter{BookCounter}%
\vbox{%
\noindent{BOOK \Roman{BookCounter}\newline\textbf{#1}}%
}%
}
\renewcommand{\title}[1]{
\bigskip%
\stepcounter{TitleCounter}%
\needspace{15\baselineskip}%
\vbox{%
\noindent{TITLE \Roman{TitleCounter}\newline\textbf{#1}}%
}%
}
\newcommand{\chapter}[1]{%
\bigskip%
\stepcounter{ChapterCounter}%
\needspace{10\baselineskip}%
\vbox{%
\noindent{CHAPTER \Roman{ChapterCounter}\newline\textbf{#1}}%
}%
}
\renewcommand{\paragraph}[1]{%
\bigskip%
\stepcounter{ParagraphCounter}%
\needspace{10\baselineskip}%
\vbox{%
\noindent{\textbf{§ \arabic{ParagraphCounter}.\arabic{SubParagraphCounter}. #1}}\newline%
}%
}
\renewcommand{\subparagraph}[1]{%
\bigskip%
\stepcounter{SubParagraphCounter}%
\needspace{10\baselineskip}%
\vbox{%
\noindent{\textbf{§ \arabic{ParagraphCounter}.\arabic{SubParagraphCounter}. #1}}\newline%
}%
}
\newcommand{\article}[2]{%
\stepcounter{ArticleCounter}%
\needspace{5\baselineskip}%
\ifnum\value{BookCounter}>0
\hbox{%
\articleindent\textbf{Art. \arabic{BookCounter}:\arabic{ArticleCounter}}\newline%
}
\marginpar{#1}
\else
\hbox{%
\articleindent\textbf{Art. \arabic{ArticleCounter}}\newline%
}
\marginpar{#1}
\fi
\par{#2}%
}
\newcommand{\subarticle}[2]{%
\stepcounter{ArticleSubCounter}%
\needspace{5\baselineskip}%
\ifnum\value{BookCounter}>0
\hbox{
\articleindent\textbf{Art. \arabic{BookCounter}:\arabic{ArticleCounter}\alph{ArticleSubCounter}}\newline%
}
\marginpar{#1}
\else
\hbox{
\articleindent\textbf{Art. \arabic{ArticleCounter}\alph{ArticleSubCounter}}\newline%
}
\marginpar{#1}
\fi
\par{#2}%
}
% Header and footer
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}