summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/unifront
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/unifront')
-rw-r--r--macros/latex/contrib/unifront/README.txt37
-rw-r--r--macros/latex/contrib/unifront/unifront-example.pdfbin0 -> 70083 bytes
-rw-r--r--macros/latex/contrib/unifront/unifront-example.tex98
-rw-r--r--macros/latex/contrib/unifront/unifront-manual.pdfbin0 -> 140638 bytes
-rw-r--r--macros/latex/contrib/unifront/unifront-manual.tex173
-rw-r--r--macros/latex/contrib/unifront/unifront.sty218
6 files changed, 526 insertions, 0 deletions
diff --git a/macros/latex/contrib/unifront/README.txt b/macros/latex/contrib/unifront/README.txt
new file mode 100644
index 0000000000..fa42a950dc
--- /dev/null
+++ b/macros/latex/contrib/unifront/README.txt
@@ -0,0 +1,37 @@
+--------------------------------------------------------------------------
+the UNIFRONT package v1.0 2023/05/07
+
+ Gives your notes a unique front page for every chapter and section.
+
+--------------------------------------------------------------------------
+Web: https://github.com/weifanw/unifront
+E-Mail: weifan.wei@student.unimelb.edu.au
+--------------------------------------------------------------------------
+Copyright 2023 Weifan Wei
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3c
+of this license or (at your option) any later version.
+The latest version of this license is in
+ https://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of LaTeX
+version 2008 or later.
+
+This work has the LPPL maintenance status `maintained'.
+
+The Current Maintainer of this work is Weifan Wei
+--------------------------------------------------------------------------
+The unifront package consists of the following files:
+ == STYLE FILES ==
+ unifront.sty
+ == DOCUMENTATION FILES ==
+ unifront-example.tex
+ unifront-example.pdf
+ unifront-manual.tex
+ unifront-manual.pdf
+ README
+--------------------------------------------------------------------------
+Hope the above is useful to you.
+I am always glad to receive all comments and suggestions.
+Please feel free to contact me at your convenience.
+-------------------------------------------------------------------------- \ No newline at end of file
diff --git a/macros/latex/contrib/unifront/unifront-example.pdf b/macros/latex/contrib/unifront/unifront-example.pdf
new file mode 100644
index 0000000000..f2ce74c424
--- /dev/null
+++ b/macros/latex/contrib/unifront/unifront-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/unifront/unifront-example.tex b/macros/latex/contrib/unifront/unifront-example.tex
new file mode 100644
index 0000000000..9c5c62a260
--- /dev/null
+++ b/macros/latex/contrib/unifront/unifront-example.tex
@@ -0,0 +1,98 @@
+%% Preset
+\documentclass[a4paper, twoside]{report}
+
+\usepackage[blue]{unifront}
+\usepackage{hyperref}
+
+%% Document information
+\author{Weifan W.}
+\date{04/05/2023}
+
+%% Document start from here
+\begin{document}
+
+\newtitle{This is a title name}{5}{\currentchapter{chapter1name}{chapter2name}}
+
+%% Chapter1 start from here
+\newchapter{chapter1name}{12}{\currentsections{section1name}{section2name}{section3name}{section4name}}
+
+%% section1 start from here
+\newsection{section1name}{5}{\currentsubsections{subsection1name}{subsection2name}}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection1name}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection2name}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+%% section2 start from here
+\newsection{section2name}{5}{\currentsubsections{subsection3name}}
+
+\newsubsection{subsection3name}
+This is a sentence.\\
+This is a sentence.
+
+%% section3 start from here
+\newsection{section3name}{4}{\currentsubsections{subsection4name}{subsection5name}{subsection6name}{subsection7name}}
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection4name}
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection5name}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection6name}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+%% section4 start from here
+\newsection{section4name}{5}{\currentsubsections{subsection7name}}
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection7name}
+This is a sentence.\\
+This is a sentence.
+
+%% Chapter2 start from here
+\newchapter{chapter2name}{9}{\currentsections{section5name}{section6name}}
+
+%% section5 start from here
+\newsection{section5name}{5}{\currentsubsections{subsection8name}{subsection9name}}
+
+\newsubsection{subsection8name}
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection9name}
+This is a sentence.\\
+This is a sentence.
+
+%% section6 start from here
+\newsection{section6name}{5}{\currentsubsections{subsection10name}{subsection11name}}
+
+\newsubsection{subsection10name}
+This is a sentence.\\
+This is a sentence.
+
+\newsubsection{subsection11name}
+This is a sentence.\\
+This is a sentence.\\
+This is a sentence.
+
+\end{document}
diff --git a/macros/latex/contrib/unifront/unifront-manual.pdf b/macros/latex/contrib/unifront/unifront-manual.pdf
new file mode 100644
index 0000000000..fc920a3a23
--- /dev/null
+++ b/macros/latex/contrib/unifront/unifront-manual.pdf
Binary files differ
diff --git a/macros/latex/contrib/unifront/unifront-manual.tex b/macros/latex/contrib/unifront/unifront-manual.tex
new file mode 100644
index 0000000000..f903b803db
--- /dev/null
+++ b/macros/latex/contrib/unifront/unifront-manual.tex
@@ -0,0 +1,173 @@
+% \iffalse meta-comment
+%% unifront-manual.tex
+%% Copyright 2023 Weifan Wei
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% https://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2008 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Weifan Wei
+%
+% This work consists of the files unifront-manual.tex and unifront.sty.
+% \fi
+% \iffalse
+%<*driver>
+\ProvidesFile{unifront-manual.tex}[2023-05-07 v1.0 Unique front structure]
+\documentclass{ltxdoc}
+\title{An Unique Front Structure}
+\author{Weifan Wei}
+\date{2023/05/07}
+\begin{document}
+\maketitle
+ \DocInput{unifront-manual.tex}
+\end{document}
+%</driver>
+% \fi
+% \section{Introduction}
+% This package can help you format your notes easily and give them a unique front page for every chapter and section.
+% It calculates your progress and then displays the progress bar under the title.
+% It also displays a partial table of contents under every progress bar and only shows the subdirectories of the current part.
+% To generate this, you can simply enter your current completed titles with a command that accepts Variable Arguments. Still, that also helped you review your notes.
+% You can also customise the colour of the bar.
+% \section{Commands}
+% \begin{macro}{\usepackage}
+% \cmd{\usepackage\oarg{options}\{unifront\}} \\
+% \oarg{options}: You can choose from 'red', 'blue', 'yellow', 'help'.
+% \end{macro}
+%
+% \begin{macro}{\currentchapter}
+% \cmd{\currentchapter\marg{chapter name}\marg{chapter name}...\marg{chapter name}...}\\
+% You can put many \marg{chapter name} as you want after \cmd{\currentchapter} .\\
+% \marg{chapter name}: The name of completed chapter.
+% \end{macro}
+%
+% \begin{macro}{\currentsections}
+% \cmd{\currentsections\marg{section name}\marg{section name}...\marg{section name}...}\\
+% You can put many \marg{section name} as you want after \cmd{\currentsections}.\\
+% \marg{section name}: The name of completed section.
+% \end{macro}
+%
+% \begin{macro}{\currentsubsections}
+% \cmd{\currentsubsections\marg{subsection name}...\marg{subsection name}...}\\
+% You can put many \marg{subsection name} as you want after \cmd{\currentsubsections}.\\
+% \marg{subsection name}: The name of completed subsection.
+% \end{macro}
+%
+% \begin{macro}{\newtitle}
+% \cmd{\newtitle\marg{title name}\marg{number of chapters}\{\cs{currentchapter}\marg{n}\marg{n}...\}}\\
+% It generate the front page for your document.\\
+% \marg{title name}: The name of your document.\\
+% \marg{number of chapters}: The total number of the chapters you are planing to do.\\
+% \{\cs{currentchapter}\marg{n}...\}: Put the name of each completed chapter in to \marg{n} in order.
+% \end{macro}
+%
+% \begin{macro}{\newchapter}
+% \cmd{\newchapter\marg{chapter name}\marg{number of sections}\{\cs{currentsection}\marg{n}\marg{n}...\}}\\
+% It generate the front page for the current chapter.\\
+% \marg{chapter name}: The name of the chapter.\\
+% \marg{number of sections}: The total number of the sections you are planing to do.\\
+% \{\cs{currentsection}\marg{n}...\}: Put the name of each completed section in to \marg{n} in order.
+% \end{macro}
+%
+% \begin{macro}{\newsection}
+% \cmd{\newsection\marg{section name}\marg{number of subsections}\{\cs{currentsubsection}\marg{n}\marg{n}...\}}\\
+% It generate the front page for the current section.\\
+% \marg{section name}: The name of the section.\\
+% \marg{number of subsections}: The total number of the subsections you are planing to do.\\
+% \{\cs{currentsection}\marg{n}...\}: Put the name of each completed subsection in to \marg{n} in order.
+% \end{macro}
+%
+% \begin{macro}{\newsubsection}
+% \cmd{\newsubsection\marg{subsection name}}\\
+% It give you a subsection \\
+% \marg{subsection name}: The name of the subsection.
+% \end{macro}
+%
+% \section{Example}
+% The basic structure should look like the following:\footnote{Go to \url{https://github.com/weifanw/unifront} for more information}
+\begin{verbatim}
+%% Preset
+\documentclass[a4paper, twoside]{report}
+
+\usepackage[blue]{unifront}
+\usepackage{hyperref}
+
+%% Document information
+\author{Weifan W.}
+\date{04/05/2023}
+
+%% Document start from here
+\begin{document}
+
+\newtitle{This is a title name}{5}{\currentchapter{chapter1name}{chapter2name}}
+
+%% Chapter1 start from here
+\newchapter{chapter1name}{12}{\currentsections{section1name}{section2name}{section3name}{section4name}}
+
+%% section1 start from here
+\newsection{section1name}{5}{\currentsubsections{subsection1name}{subsection2name}}
+This is a sentence.
+
+\newsubsection{subsection1name}
+This is a sentence.
+
+\newsubsection{subsection2name}
+This is a sentence.
+
+%% section2 start from here
+\newsection{section2name}{5}{\currentsubsections{subsection3name}}
+
+\newsubsection{subsection3name}
+This is a sentence.
+
+%% section3 start from here
+\newsection{section3name}{4}{\currentsubsections{subsection4name}{subsection5name}{subsection6name}{subsection7name}}
+This is a sentence.
+
+\newsubsection{subsection4name}
+This is a sentence.
+
+\newsubsection{subsection5name}
+This is a sentence.
+
+\newsubsection{subsection6name}
+This is a sentence.
+
+%% section4 start from here
+\newsection{section4name}{5}{\currentsubsections{subsection7name}}
+
+\newsubsection{subsection7name}
+This is a sentence.
+
+%% Chapter2 start from here
+\newchapter{chapter2name}{9}{\currentsections{section5name}{section6name}}
+
+%% section5 start from here
+\newsection{section5name}{5}{\currentsubsections{subsection8name}{subsection9name}}
+
+\newsubsection{subsection8name}
+This is a sentence.
+
+\newsubsection{subsection9name}
+This is a sentence.
+
+%% section6 start from here
+\newsection{section6name}{5}{\currentsubsections{subsection10name}{subsection11name}}
+
+\newsubsection{subsection10name}
+This is a sentence.
+
+\newsubsection{subsection11name}
+This is a sentence.
+
+\end{document}
+\end{verbatim}
+% \Finale
+%
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/unifront/unifront.sty b/macros/latex/contrib/unifront/unifront.sty
new file mode 100644
index 0000000000..81179aafb4
--- /dev/null
+++ b/macros/latex/contrib/unifront/unifront.sty
@@ -0,0 +1,218 @@
+%% unifront.sty
+%% Copyright 2023 Weifan Wei
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% https://www.latex-project.org/lppl.txt
+% and version 1.3c or later is part of all distributions of LaTeX
+% version 2008 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Weifan Wei
+%
+% This work consists of the files unifront-manual.tex and unifront.sty.
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{unifront}[2023/05/07 v1.0 Unique front structure]
+
+% Package requirements
+\RequirePackage{xcolor}
+\RequirePackage{calc}
+
+% Page setup
+\setlength{\oddsidemargin}{0.25 in}
+\setlength{\evensidemargin}{-0.1 in}
+\setlength{\topmargin}{-0.7 in}
+\setlength{\textwidth}{6.1 in}
+\setlength{\textheight}{9.5 in}
+\setlength{\headsep}{0.4 in}
+\setlength{\parindent}{0 in}
+\setlength{\parskip}{0 in}
+
+% Global variables
+\newcommand{\front@size}{0.97\textwidth}
+\newcommand{\bars@vertical@size}{1ex}
+
+% Colour setup
+\definecolor{my@red}{RGB}{255, 0, 0}
+\definecolor{my@blue}{RGB}{26, 140, 255}
+\definecolor{my@yellow}{RGB}{255, 255, 0}
+\definecolor{my@gray}{RGB}{191, 191, 191}
+
+% Default colour
+\newcommand{\bar@colour}{my@blue}
+\newcommand{\bar@other@half}{my@gray}
+
+% The options of this package
+\DeclareOption{red}{%
+ \renewcommand{\bar@colour}{my@red}%
+ \PackageInfo{unifront}{bar's colour has been set to red}%
+}
+\DeclareOption{blue}{%
+ \renewcommand{\bar@colour}{my@blue}%
+ \PackageInfo{unifront}{bar's colour has been set to blue}%
+}
+\DeclareOption{yellow}{%
+ \renewcommand{\bar@colour}{my@yellow}%
+ \PackageInfo{unifront}{bar's colour has been set to yellow}%
+}
+\DeclareOption{help}{%
+ \PackageWarningNoLine{unifront}{Go to https://github.com/weifanw/unifront for more information}
+ \PackageInfo{unifront}{bar's colour has been set to yellow}%
+}
+\DeclareOption*{%
+ \PackageWarning{unifront}{Unknown Colour ‘\CurrentOption’, You can choose from 'red', 'blue', 'yellow', 'help'}%
+ \PackageInfo{unifront}{bar's colour retain the default}%
+}
+\ProcessOptions\relax
+
+% Print content line
+\newcounter{chapter@counter}
+\newcounter{section@counter}[chapter]
+\newcounter{subsection@counter}[section]
+\newcounter{odd@even}
+
+\newcommand{\print@chapter@line}[1]{%
+ \contentsline{chapter}{%
+ \numberline{\thechapter@counter}#1%
+ }{%
+ \pageref{#1}%
+ }\\
+ \PackageInfo{unifront}{content line '#1' has been generate}%
+}
+\newcommand{\print@section@line}[1]{%
+ \contentsline{section}{%
+ \numberline{\ref{#1}}#1%
+ }{%
+ \pageref{#1}%
+ }\\
+ \PackageInfo{unifront}{content line '#1' has been generate}%
+}
+\newcommand{\print@subsection@line}[1]{%
+ \contentsline{subsection}{%
+ \numberline{\ref{#1}}#1%
+ }{%
+ \pageref{#1}%
+ }\\
+ \PackageInfo{unifront}{content line '#1' has been generate}%
+}
+
+% Count current elements
+\newcommand{\count@chapters}[2]{%
+ \refstepcounter{chapter@counter}%
+ \currentchapter{#2}%
+}
+\newcommand{\count@sections}[2]{%
+ \refstepcounter{section@counter}%
+ \currentsections{#2}%
+}
+\newcommand{\count@subsections}[2]{%
+ \refstepcounter{subsection@counter}%
+ \currentsubsections{#2}%
+}
+
+% Get current elements
+\newcommand{\currentchapter}[1]{%
+ \ifodd\theodd@even{%
+ \PackageInfo{unifront}{print chapter's content line '#1' }%
+ \print@chapter@line{#1}%
+ }%
+ \fi
+ \@ifnextchar\bgroup{%
+ \PackageInfo{unifront}{count chapter '#1' }%
+ \count@chapters{#1}%
+ }{%
+ \refstepcounter{chapter@counter}%
+ }%
+}
+\newcommand{\currentsections}[1]{%
+ \ifodd\theodd@even{%
+ \PackageInfo{unifront}{print section's content line '#1' }%
+ \print@section@line{#1}%
+ }%
+ \fi
+ \@ifnextchar\bgroup{%
+ \PackageInfo{unifront}{count section '#1' }%
+ \count@sections{#1}%
+ }{%
+ \refstepcounter{section@counter}%
+ }%
+}
+\newcommand{\currentsubsections}[1]{%
+ \ifodd\theodd@even{%
+ \PackageInfo{unifront}{print subsection's content line '#1' }%
+ \print@subsection@line{#1}%
+ }\fi
+ \@ifnextchar\bgroup{%
+ \PackageInfo{unifront}{count subsection '#1' }%
+ \count@subsections{#1}%
+ }{%
+ \refstepcounter{subsection@counter}%
+ }%
+}
+
+% Print the corresponding progress bar
+\newcommand{\progress@bar}[2]{%
+ \textcolor{\bar@colour}{%
+ \rule{\front@size * #1 / \real{#2}}{\bars@vertical@size}%
+ }%
+ \textcolor{\bar@other@half}{%
+ \rule{\front@size - \front@size * #1 / \real{#2}}{\bars@vertical@size}%
+ }%
+ \setcounter{chapter@counter}{1}%
+}
+
+% Generate the corresponding front page
+\newcommand{\newtitle}[3]{%
+ \title{#1}%
+ \clearpage
+ \pagestyle{myheadings}%
+ \thispagestyle{empty}%
+ \begin{center}%
+ \begin{tabular}{p{\front@size}}%
+ \maketitle\\
+ \setcounter{odd@even}{2}#3%
+ \progress@bar{\value{chapter@counter}}{#2}\\
+ \setcounter{odd@even}{1}%
+ #3%
+ \end{tabular}%
+ \end{center}%
+ \PackageInfo{unifront}{new report #1's front page has been generate}%
+ \newpage%
+ \setcounter{page}{1}%
+}
+\newcommand{\newchapter}[3]{%
+ \clearpage
+ \thispagestyle{plain}%
+ \begin{center}%
+ \begin{tabular}{p{\front@size}}%
+ \chapter{#1}\\\label{#1}%
+ \setcounter{odd@even}{2}#3%
+ \progress@bar{\value{section@counter}}{#2}\\
+ \setcounter{odd@even}{1}%
+ {\bf\Large#3}%
+ \end{tabular}%
+ \end{center}%
+ \markboth{#1}{#1}%
+ \PackageInfo{unifront}{new chapter #1's front page has been generate}%
+}
+\newcommand{\newsection}[3]{%
+ \clearpage
+ \thispagestyle{plain}%
+ \begin{center}%
+ \begin{tabular}{p{\front@size}}%
+ \section{#1}\label{#1}%
+ \setcounter{odd@even}{2}#3%
+ \progress@bar{\value{subsection@counter}}{#2}\\
+ \setcounter{odd@even}{1}%
+ \bf#3%
+ \end{tabular}%
+ \end{center}%
+ \PackageInfo{unifront}{new section #1's front page has been generate}%
+}
+\newcommand{\newsubsection}[1]{%
+ \subsection{#1}\label{#1}%
+}
+\endinput \ No newline at end of file