summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/chs-physics-report/chs-physics-report.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/chs-physics-report/chs-physics-report.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/chs-physics-report/chs-physics-report.sty')
-rw-r--r--macros/latex/contrib/chs-physics-report/chs-physics-report.sty170
1 files changed, 170 insertions, 0 deletions
diff --git a/macros/latex/contrib/chs-physics-report/chs-physics-report.sty b/macros/latex/contrib/chs-physics-report/chs-physics-report.sty
new file mode 100644
index 0000000000..3eea90cd2e
--- /dev/null
+++ b/macros/latex/contrib/chs-physics-report/chs-physics-report.sty
@@ -0,0 +1,170 @@
+% Hi! You have opened the CHS Physics Lab Report Package, written
+% by Gary Zhang. With the exception of a code snippet below from
+% Stefan Kottwitz, all the code in this package may be considered
+% as public domain.
+%
+% To install this package, follow the instructions found here:
+% http://artofproblemsolving.com/wiki/index.php?title=LaTeX:Packages#Making_Your_Own
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{chs-physics-report}[2017/11/23 CHS Physics Lab Report] % look! They're all prime!
+
+\RequirePackage{amsmath}
+\RequirePackage{fancyhdr}
+\RequirePackage{geometry}
+\geometry{top = 2.5cm, bottom = 2.5cm}
+\RequirePackage{transparent}
+\RequirePackage{calc}
+\RequirePackage{graphicx}
+\RequirePackage{titlesec}
+\RequirePackage{color}
+\RequirePackage[svgnames]{xcolor}
+\RequirePackage{letltxmacro}
+% ------------------------------------------------------
+% Square root code below by Stefan Kottwitz, from
+% TeX Stack Exchange, used under a CC BY-SA 3.0 License.
+% This section is the only part of this code NOT in the
+% public domain.
+%
+% Edited to improve resolution at over 15000\% zoom
+%
+\let\oldr@@t\r@@t
+\def\r@@t#1#2{%
+\setbox0=\hbox{$\oldr@@t#1{#2\,}$}\dimen0=\ht0
+\advance\dimen0-0.167\ht0
+\setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
+{\box0\lower0.478pt\box2}}
+\LetLtxMacro{\oldsqrt}{\sqrt}
+\renewcommand*{\sqrt}[2][\ ]{\oldsqrt[#1]{#2\!}}
+%
+% end of copyrighted code
+% ------------------------------------------------------
+
+\let\@title\undefined
+\let\@author\undefined
+\def\@titleArgs{}
+\def\@subTitleArgs{}
+\def\@sectionArgs{\Large\bfseries}
+\newcommand{\titlestyle}[1]{\def\@titleArgs{#1}}
+\newcommand{\subtitlestyle}[1]{\def\@subTitleArgs{#1}}
+\newcommand{\sectionstyle}[1]{\def\@sectionArgs{#1}}
+\DeclareOption{light}{
+ \fancypagestyle{light}{
+ \fancyhf{}
+ \cfoot{\textsf{\textbf{-\raisebox{-.7pt}{\thepage}-}}}
+ \renewcommand{\headrulewidth}{0pt}
+ }
+ \fancypagestyle{light-first-page}{
+ \fancyhf{}
+ \lhead{
+ \emph{\small\@titleArgs\@title}\\
+ }
+ \rhead{
+ {\small\@subTitleArgs\@author%
+ \@workedWith}%
+ }
+ \cfoot{\textsf{\textbf{-\raisebox{-.7pt}{\thepage}-}}
+ }
+ \renewcommand{\headrulewidth}{.6pt}
+ \fancyhfoffset{13mm}
+ }
+ \pagestyle{light}
+ \AtBeginDocument{\thispagestyle{light-first-page}}
+ \def\haiku{\hspace{-55pt}\emph{Haiku:}\hspace{35.25pt}}
+ \def\haikus{\hspace{-60pt}\emph{Haikus:}\hspace{35.25pt}}
+ \def\maketitle{\PackageWarning{chs-physics-report}{
+ Remember that maketitle is no longer useful
+ because you are using the light option of
+ CHS Physics Report, so all the information
+ that would have been included in maketitle
+ is now in the header of the first page.}}
+}
+
+\DeclareOption{standard}{
+ \renewcommand{\maketitle}{%
+ \begin{center}{\Huge\textbf{\@titleArgs\@title}}\\%
+ {\small\@subTitleArgs\@author\@workedWith}
+ \end{center}
+ }
+ \ifx\@workedWith\undefined
+ \def\@workedWith{{Please set the names of those whom you %
+ worked with by typing \texttt{\char`\\%
+ ww\{\textrm{\emph{others in your lab group}}\}}}}
+ \fi
+ % for compatibility with the light option:
+ \newcommand{\haiku}[1]{\begin{center}#1\end{center}}
+ \newcommand{\haikus}[1]{\begin{center}#1\end{center}}
+}
+
+\ifx\@author\undefined
+ \author{Please enter your name by using \texttt{\char`\\%
+ name\char`\{\emph{your name}\char`\}}}
+\fi
+% Okay, so I have tried \errmessage and \PackageError for these if statements, and neither work better than what I have here, bad though it is
+\ifx\@title\undefined
+ \title{Please set the title by typing %
+ \texttt{\char`\\%
+ title\char`\{{\emph{title of lab report}}\char`\}}}
+\fi
+\ifx\@workedWith\undefined
+ \def\@workedWith{{\\Please set the names of those whom you %
+ worked with by typing \texttt{\char`\\%
+ ww\char`\{{\emph{others in your lab group}}\char`\}}}}
+\fi
+
+\DeclareOption{display}{\everymath{\displaystyle}}
+
+\DeclareOption{inline-math}{\everymath{}}
+
+\ExecuteOptions{display,standard}
+
+\ProcessOptions\relax
+
+
+\setlength{\parskip}{2.5mm}
+\newcommand{\fig}[1]{\textsc{Figure~#1}}
+\newcommand{\diff}{\mathrm d}
+
+% ------------ useless stuff -------------
+\@ifpackageloaded{amsmath}{\DeclareMathOperator*{\sfsum}{\fontsize{.9cm}{1cm}\text{$\mathsf\Sigma$}}
+\DeclareMathOperator*{\sfprod}{\fontsize{.9cm}{1cm}\text{$\mathsf\Pi$}}}
+% ----------------------------------------
+
+\newlength{\@boxwidth}
+\setlength{\@boxwidth}{13 mm}
+% \@boxwidth sets the distance from the dot to the section title
+
+\titleformat{\section}
+{%
+ \@sectionArgs%
+}
+{\hspace{-\@boxwidth}%
+ \makebox[\@boxwidth][l]%
+ {%
+ \thesection%
+ \hspace{\fill}%
+ {\raisebox{1.7pt}{\fontsize{14.4pt}{0pt}\selectfont$\bullet$}}%
+ \hspace{\fill}\hspace{.3mm}%
+ }%
+}
+{0cm}
+{}
+
+\let\footnoteDuplic@teDuplic@te\footnote
+\def\footnoteDuplic@te#1{$^\text{Note }$\footnoteDuplic@teDuplic@te{#1}} % yes, I know my jokes are never funny any more
+\let\footnote\footnoteDuplic@te
+% I also am pretty certain this is not good practice, but I do not
+% know how to do anything better!
+
+% \providecommand is used instead of \newcommand so that if
+% other packages that define either one of these are loaded,
+% there will not be an error due to conflicting definitions.
+\providecommand{\degree}{^\circ}
+\providecommand{\degrees}{\degree}
+
+% defines information for titles
+\newcommand{\name}[1]{\author{#1}}
+\newcommand{\ww}[1]{\def\@workedWith{\\Worked with #1}}
+
+
+\endinput \ No newline at end of file