Skip to content

Commit

Permalink
include classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Headary committed Jun 11, 2022
1 parent 6bcdb01 commit ea43beb
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 4 deletions.
4 changes: 2 additions & 2 deletions fyzika/template.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{krska}}
\ProcessOptions
\LoadClass[11pt,a4paper]{krska}
\LoadClass[11pt,a4paper]{../../krska}

\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage{czech}

\RequirePackage{krskasugar}
\RequirePackage{../../krskasugar}
\newcommand\uv[1]{„#1“}
\RequirePackage{fkssugar}

Expand Down
4 changes: 2 additions & 2 deletions ivt/template.cls
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{krska}}
\ProcessOptions
\LoadClass[11pt,a4paper]{krska}
\LoadClass[11pt,a4paper]{../../krska}

\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\setmainlanguage[splithyphens=false]{czech}

\RequirePackage{krskasugar}
\RequirePackage{../../krskasugar}
\newcommand\uv[1]{„#1“}
\RequirePackage{fkssugar}

Expand Down
110 changes: 110 additions & 0 deletions krska.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
%
% @author Adam Krška <[email protected]>
% @date 24.10.2020
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{krska}

% -- Create new options --
% show date if wanted
\newif\if@usedate \@usedatefalse
\DeclareOption{date}{\@usedatetrue}


% -- inherit from article class --
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\ProcessOptions
\LoadClass{extarticle}

% -- Load packages --
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern} % specify used font
\RequirePackage[
pdftex,
margin=2cm,
headsep=0.8cm,
headheight=14pt]{geometry}
\RequirePackage{fancyhdr} % enable changing header and footer
\RequirePackage{lastpage} % get number of pages
\RequirePackage[nobottomtitles]{titlesec} % change headins style
\renewcommand{\bottomtitlespace}{0.05\textheight}
\RequirePackage[
pdfusetitle,
pdfproducer={Latex, or other tool},
pdfcreator={pdflatex, or other tool}
]{hyperref} % create links in file


% -- change headings to sans font --
\titleformat*{\section}{\Large\bfseries\sffamily}
\titleformat*{\subsection}{\large\bfseries\sffamily}
\titleformat*{\subsubsection}{\bfseries\sffamily}
\titleformat*{\paragraph}{\bfseries\sffamily}
\titleformat*{\subparagraph}{\bfseries\sffamily}


% -- specify header and footer --
\fancyhf{}
\if@twoside
\fancyhead[RO]{\bfseries\@author}
\if@usedate
\fancyhead[RO]{\@date, \bfseries\@author}
\fi
\fancyhead[LE]{\@title}
\fancyfoot[RO,LE]{\thepage/\pageref{LastPage}}
\else
\fancyhead[R]{\bfseries\@author}
\if@usedate
\fancyhead[R]{\@date, \bfseries\@author}
\fi
\fancyhead[L]{\@title}
\fancyfoot[C]{\thepage/\pageref{LastPage}}
\fi
\pagestyle{fancy}

\fancypagestyle{titlepage}{
\renewcommand{\headrulewidth}{0pt}%
\fancyhead{}
}


% -- change maketitle --
\newlength{\beforetitlespace} \setlength{\beforetitlespace}{1em}
\if@titlepage
\renewcommand{\maketitle}{
\begingroup
\begin{titlepage}
\null\vfil
\vskip 100pt
\centering
{\huge \bfseries \sffamily \@title}\\[3em]
{\LARGE \sffamily \@author}
\if@usedate
\vskip 3em
{\Large \sffamily \@date}
\fi
\vfil\null
\end{titlepage}
\endgroup
}
\else
\renewcommand{\maketitle}{
\begingroup
\thispagestyle{titlepage}
\begin{raggedright}
\null
\vskip \beforetitlespace
{\LARGE \bfseries \sffamily \@title}\\[1.5em]
{\Large \sffamily \@author}
\if@usedate
\vskip 1.5em
{\large \sffamily \@date}
\fi
\vskip 1.5em
\end{raggedright}
\endgroup
}
\fi

\renewcommand{\theenumiii}{\Roman{enumiii}}
84 changes: 84 additions & 0 deletions krskasugar.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{krskasugar}

% -- load packages --
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{amssymb}
\RequirePackage{graphicx} % figures
\RequirePackage{wrapfig} % wraping figures
\RequirePackage[justification=centering]{caption}
\RequirePackage{xparse}
\RequirePackage{xargs}
\RequirePackage{ifthen}


% -- lazy math --
\RenewDocumentCommand\frac{ m g }{%
{%
\IfNoValueF {#2} {\ensuremath{\begingroup#1\endgroup\@@over#2}}%
\IfNoValueT {#2} {\ensuremath{\begingroup1\endgroup\@@over#1}}%
}%
}
\RenewDocumentCommand\dfrac{ m g }{%
\IfNoValueF {#2} {\ensuremath{\genfrac{}{}{}0{#1}{#2}}}%
\IfNoValueT {#2} {\ensuremath{\genfrac{}{}{}0{1}{#1}}}%
}

\newcommand\avg[1]{\mkern 1.5mu\overline{\mkern-1.5mu#1\mkern-1.5mu}\mkern 1.5mu}

% -- figure commands --
\captionsetup[table]{name=Tab.}
\captionsetup[figure]{name=Obr.}


% command for fullpage figure
% Some variants:
% \fullfig{fig.}[caption]
% \fullfig[fig param]{fig.}[caption][label]
% \fullfig[fig param][placement]{fig.}[caption][label]
\newcommandx*\fullfig[6][1=, 2=htbp, 4=, 5=, 6=]{
\begin{figure}[#2]
\centering
\ifthenelse{\equal{#1}{}}{
\includegraphics[width=0.7\linewidth]{#3}
}{
\includegraphics[#1]{#3}
}
\ifthenelse{\equal{#4}{}}{}{\ifthenelse{\equal{#6}{}}{\caption{#4}}{\caption[#6]{#4}}}
\ifthenelse{\equal{#5}{}}{}{\label{#5}}
\end{figure}
}

% command for plots in .tex format
% \wrapfig[placement]{fig.}[caption][label]
\newcommandx*\plotfig[4][1=htbp, 3=, 4=]{
\begin{figure}[#1]
\centering
\input{#2}
\ifthenelse{\equal{#3}{}}{}{\caption{#3}}
\ifthenelse{\equal{#4}{}}{}{\label{#4}}
\end{figure}
}

% Figures wraping around text
% \wrapfig[outside size][fig params][placement][number of lines]{fig}[caption][label]
\newcommandx*\wrapfig[7][1=, 2=, 3=, 4=, 6=, 7=]{
% set default value for outside size
\ifthenelse{\equal{#1}{}}{
\def\@outsidesize{0.30\textwidth}}{
\def\@outsidesize{#1}}
% set default value for placement
\ifthenelse{\equal{#3}{}}{
\def\@placement{O}}{
\def\@placement{#3}}

\begin{wrapfigure}[#4]{\@placement}{\@outsidesize}
\centering
\ifthenelse{\equal{#2}{}}{
\includegraphics[width=0.95\linewidth]{#5}}{
\includegraphics[#2]{#5}}
\ifthenelse{\equal{#6}{}}{}{\caption{#6}}
\ifthenelse{\equal{#7}{}}{}{\label{#7}}
\end{wrapfigure}
}

0 comments on commit ea43beb

Please sign in to comment.