对自创的 .sty 文件进行代码审查

对自创的 .sty 文件进行代码审查

我将在接下来的几周内开始用 LaTeX 撰写我的硕士论文。我已经构建了自己的 .sty 并将其集成到我的文档中。一切都运行良好,看起来应该如此,但如果有专家可以看看它并给我一些如何改进/升级我的风格的提示,那就太好了 :)

%% `MyStyle.sty'
\RequirePackage{kvoptions}
\RequirePackage{comment}
\setuptoc{toc}{totoc}
\PassOptionsToPackage{dvipsnames}{xcolor}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{draftwatermark}
\RequirePackage{scrhack}
\RequirePackage[right=30mm,left=25mm,top=20mm,bottom=20mm,includeheadfoot]{geometry}
\RequirePackage[T1]{fontenc}
\RequirePackage[babel,german=quotes]{csquotes}
\RequirePackage[ngerman]{babel}
\RequirePackage[binary-units=true,locale = DE]{siunitx}
\RequirePackage{texnames}
\RequirePackage{paralist}
\RequirePackage{listings}
\RequirePackage[figure,table,lstlisting,equation]{totalcount}
\RequirePackage{float}
\RequirePackage{caption}
\RequirePackage{textcomp}
\RequirePackage{gensymb}
\RequirePackage{lmodern}
\RequirePackage[onehalfspacing]{setspace}
\RequirePackage{layout}
\RequirePackage{placeins}
\RequirePackage{chngcntr}
\RequirePackage{enumitem}
\RequirePackage{hyperref}
\RequirePackage[nonumberlist,acronym,toc]{glossaries-extra}
\RequirePackage{rotating}
\RequirePackage{media9}
\RequirePackage[autooneside=false,automark,headsepline]{scrlayer-scrpage}
\RequirePackage{microtype}
\RequirePackage{fontawesome}
\RequirePackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usetikzlibrary{patterns}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.pathreplacing} 
\usetikzlibrary{intersections}
\RequirePackage[backend=biber,style=ieee,sortlocale=de_DE,natbib=true]{biblatex}

% Smaller underscore
\DeclareTextCommand{\_}{T1}{\leavevmode \kern.06em\vbox{\hrule width.4em}}
% Enlarge equation vspace
\setlength{\jot}{3mm}
% Input variables
\SetupKeyvalOptions{
family=mysty@,
prefix=mysty@}
\DeclareStringOption{workString}
\DeclareStringOption{titleStringGerman}
\DeclareStringOption{titleStringEnglish}
\ProcessKeyvalOptions{mysty@}
\newcommand{\workString}{\mysty@workString}
\newcommand{\titleStringGerman}{\mysty@titleStringGerman}
\newcommand{\titleStringEnglish}{\mysty@titleStringEnglish}
% Count words variable
\newboolean{myDraft}
% Enlarge table of contents page number space
\renewcommand*{\@pnumwidth}{3em}
% Pagecounter for optional pages
\newcounter{pageCounter}
% Setup bibiography
\bibliography{_Content/_Literature}
\setlength\bibitemsep{10pt}
\DeclareFieldFormat{title}{\newline{#1}}
\DeclareFieldFormat{note}{\newline{#1}}
\DeclareFieldFormat{isbn}{\newline ISBN: {#1}}
% Format hyphenations
\hyphenpenalty=5000
\exhyphenpenalty=5000
\tolerance=5000
\hbadness=10000
% No pagebreak in literature
\patchcmd{\bibsetup}{\interlinepenalty=5000}{\interlinepenalty=10000}{}{}
% Clear default pagenumbers
\clearpairofpagestyles
\pagestyle{scrheadings}
\ihead{\leftmark}
\ohead{\rightmark}
\chead{}
\ofoot[\pagemark]{\pagemark}
% Rename "Unterabschnitt" to "Abschnitt"
\addto\extrasngerman{
\def\subsectionautorefname{Abschnitt}%
}
% Show chapter name and section name in header
\renewcommand{\chaptermark}[1]{\markleft{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
% Counter setup for figures, equations and tables
\counterwithout{figure}{chapter}
\renewcommand*{\figureautorefname}{figure}
\counterwithout{equation}{chapter}
\counterwithout{table}{chapter}
\lstset{numberbychapter=false}
% Setup list of abbreviations and list of symbols
\newglossarystyle{mylong}{
\setglossarystyle{long}
\renewenvironment{theglossary}{\begin{longtable*}[l]{@{}p{\dimexpr 2cm-\tabcolsep}p{0.8\hsize}}}{\end{longtable*}}}
% Long / short abbreviationstyle
\setabbreviationstyle[acronym]{long-short}
% Listing definitions
\lstdefinestyle{CStyle}{
backgroundcolor=\color{GreenYellow!5},
commentstyle=\color{Green},
keywordstyle=\color{RoyalBlue},
numberstyle=\tiny\color{Gray},
stringstyle=\color{Purple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false, 
tabsize=1,
language=C
}
\colorlet{punct}{red!60!black}
\definecolor{background}{HTML}{EEEEEE}
\definecolor{delim}{RGB}{20,105,176}
\colorlet{numb}{magenta!60!black}
\lstdefinelanguage{json}{ 
basicstyle=\normalfont\ttfamily, 
numbers=left,
numberstyle=\scriptsize,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frame=lines,
backgroundcolor=\color{background},
literate=
*{0}{{{\color{numb}0}}}{1}
{1}{{{\color{numb}1}}}{1}
{2}{{{\color{numb}2}}}{1}
{3}{{{\color{numb}3}}}{1}
{4}{{{\color{numb}4}}}{1}
{5}{{{\color{numb}5}}}{1}
{6}{{{\color{numb}6}}}{1}
{7}{{{\color{numb}7}}}{1}
{8}{{{\color{numb}8}}}{1}
{9}{{{\color{numb}9}}}{1}
{:}{{{\color{punct}{:}}}}{1}
{,}{{{\color{punct}{,}}}}{1}
{\{}{{{\color{delim}{\{}}}}{1}
{\}}{{{\color{delim}{\}}}}}{1}
{[}{{{\color{delim}{[}}}}{1}
{]}{{{\color{delim}{]}}}}{1},
}
% PDF metadata
\hypersetup{
unicode=false,
pdftoolbar=false,
pdfmenubar=true,
pdffitwindow=false,
pdfstartview={FitH},
pdftitle={\titleStringGerman},
pdfauthor={MyName},
pdfsubject={\workString},
pdfproducer={pdfTeX \the\pdftexversion.\pdftexrevision},
pdfkeywords={\workString},
pdfnewwindow=true,
colorlinks=true,
linkcolor=black,
citecolor=black,
filecolor=black,
urlcolor=black
}
% Macro to disable watermark
\SetWatermarkLightness{0.9} 
\makeatletter
\def\watermarkoff{
\@sc@wm@stampfalse
}
\makeatother
\endinput

提前致谢!

相关内容