| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% essaykit.dtx |
| 4 |
% Copyright (C) 2025-2026 by swifterhtmler [email protected] |
| 5 |
% |
| 6 |
% This file may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 8 |
% of this license or any later version. |
| 9 |
% The latest version of this license is in: |
| 10 |
% |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 14 |
% version 2005/12/01 or later. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\ProvidesFile{essaykit.dtx} |
| 21 |
%</driver> |
| 22 |
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] |
| 23 |
%<package>\ProvidesPackage{essaykit} |
| 24 |
%<*package> |
| 25 |
[2026/01/02 v2.0 essaykit - Styled boxes and academic formatting] |
| 26 |
%</package> |
| 27 |
% |
| 28 |
%<*driver> |
| 29 |
\documentclass{ltxdoc} |
| 30 |
\usepackage{essaykit} |
| 31 |
\usepackage{hypdoc} |
| 32 |
% \EnableCrossrefs |
| 33 |
% \CodelineIndex |
| 34 |
\RecordChanges |
| 35 |
\begin{document} |
| 36 |
\DocInput{essaykit.dtx} |
| 37 |
\PrintChanges |
| 38 |
\PrintIndex |
| 39 |
\end{document} |
| 40 |
%</driver> |
| 41 |
% \fi |
| 42 |
% |
| 43 |
% \CheckSum{132} |
| 44 |
% |
| 45 |
% |
| 46 |
% \changes{v1.0}{2025/08/30}{Initial version} |
| 47 |
% \changes{v2.0}{2026/01/02}{Added image commands and positioning} |
| 48 |
% |
| 49 |
% \GetFileInfo{essaykit.dtx} |
| 50 |
% |
| 51 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 52 |
% |
| 53 |
% \title{The \textsf{essaykit} package\thanks{This document |
| 54 |
% corresponds to \textsf{essaykit}~\fileversion, dated \filedate.}} |
| 55 |
% \author{[Swifterhtmler] \\ \texttt{[[email protected]]}} |
| 56 |
% |
| 57 |
% \maketitle |
| 58 |
% |
| 59 |
% \section{Introduction} |
| 60 |
% |
| 61 |
% The \textsf{essaykit} package provides a comprehensive set of commands for creating |
| 62 |
% styled boxes, titles, quotes, and bibliographic references in \LaTeX{} documents. |
| 63 |
% It is particularly designed for academic and scientific documents requiring |
| 64 |
% consistent styling and professional presentation. |
| 65 |
% |
| 66 |
% \section{Usage} |
| 67 |
% |
| 68 |
% \subsection{Styled Boxes} |
| 69 |
% |
| 70 |
% \DescribeMacro{\rbox} |
| 71 |
% The |\rbox| command creates customizable colored boxes: |
| 72 |
% \begin{quote} |
| 73 |
% |\rbox[|\meta{options}|]{|\meta{content}|}| |
| 74 |
% \end{quote} |
| 75 |
% |
| 76 |
% \subsection{Main Titles} |
| 77 |
% |
| 78 |
% \DescribeMacro{\maintitle} |
| 79 |
% The |\maintitle| command creates large, styled titles: |
| 80 |
% \begin{quote} |
| 81 |
% |\maintitle[|\meta{options}|]{|\meta{title text}|}| |
| 82 |
% \end{quote} |
| 83 |
% |
| 84 |
% \subsection{Quotes} |
| 85 |
% |
| 86 |
% \DescribeMacro{\quoter} |
| 87 |
% The |\quoter| command creates formatted quotations: |
| 88 |
% \begin{quote} |
| 89 |
% |\quoter[|\meta{options}|]{|\meta{quote text}|}{|\meta{author}|}| |
| 90 |
% \end{quote} |
| 91 |
% |
| 92 |
% \subsection{Rules and Sources} |
| 93 |
% |
| 94 |
% \DescribeMacro{\rrule} |
| 95 |
% The |\rrule| command creates horizontal rules. |
| 96 |
% |
| 97 |
% \DescribeMacro{\sources} |
| 98 |
% The |\sources| command creates formatted bibliography sections: |
| 99 |
% \begin{quote} |
| 100 |
% |\sources{|\meta{comma-separated list}|}| |
| 101 |
% \end{quote} |
| 102 |
% |
| 103 |
% % \subsection{Image Commands} |
| 104 |
% |
| 105 |
% \DescribeMacro{\logo} |
| 106 |
% The |\logo| command inserts an image without caption: |
| 107 |
% \begin{quote} |
| 108 |
% |\logo{|\meta{filename}|}{|\meta{width}|}| |
| 109 |
% \end{quote} |
| 110 |
% |
| 111 |
% \DescribeMacro{\fig} |
| 112 |
% The |\fig| command creates a captioned figure: |
| 113 |
% \begin{quote} |
| 114 |
% |\fig{|\meta{filename}|}{|\meta{caption}|}{|\meta{width}|}| |
| 115 |
% \end{quote} |
| 116 |
% |
| 117 |
% \subsection{Positioning Commands} |
| 118 |
% |
| 119 |
% \DescribeMacro{\placeleft} |
| 120 |
% The |\placeleft| command positions content at absolute coordinates from the left margin: |
| 121 |
% \begin{quote} |
| 122 |
% |\placeleft{|\meta{distance}|}{|\meta{content}|}{|\meta{width}|}| |
| 123 |
% \end{quote} |
| 124 |
% |
| 125 |
% \DescribeMacro{\placeright} |
| 126 |
% The |\placeright| command positions content at absolute coordinates from the right margin: |
| 127 |
% \begin{quote} |
| 128 |
% |\placeright{|\meta{distance}|}{|\meta{content}|}{|\meta{width}|}| |
| 129 |
% \end{quote} |
| 130 |
% |
| 131 |
% |
| 132 |
% \section{Implementation} |
| 133 |
% |
| 134 |
% \StopEventually{} |
| 135 |
% |
| 136 |
% \begin{macrocode} |
| 137 |
%<*package> |
| 138 |
% \end{macrocode} |
| 139 |
% |
| 140 |
% \subsection{Package Dependencies} |
| 141 |
% |
| 142 |
% \begin{macrocode} |
| 143 |
% |
| 144 |
% new packages added |
| 145 |
\RequirePackage{enumitem} |
| 146 |
\RequirePackage{graphicx} |
| 147 |
\RequirePackage{textpos} |
| 148 |
|
| 149 |
% old packages |
| 150 |
\RequirePackage{imakeidx} |
| 151 |
\RequirePackage{amsmath} |
| 152 |
\RequirePackage{caption} |
| 153 |
\RequirePackage{wrapfig} |
| 154 |
\RequirePackage{tcolorbox} |
| 155 |
\RequirePackage{tikz} |
| 156 |
\RequirePackage{chemfig} |
| 157 |
\RequirePackage{xstring} |
| 158 |
\RequirePackage{xcolor} |
| 159 |
\RequirePackage{keyval} |
| 160 |
\RequirePackage{xkeyval} |
| 161 |
\RequirePackage[pdftex, |
| 162 |
hidelinks, |
| 163 |
breaklinks=true, |
| 164 |
pdfpagemode=UseNone, |
| 165 |
pdfstartview=FitH |
| 166 |
]{hyperref} |
| 167 |
% \end{macrocode} |
| 168 |
% |
| 169 |
% \subsection{Color Definitions} |
| 170 |
% |
| 171 |
% \begin{macrocode} |
| 172 |
\definecolor{greycolour}{HTML}{525252} |
| 173 |
\definecolor{sharelatexcolour}{HTML}{882B21} |
| 174 |
\definecolor{mybluecolour}{HTML}{394773} |
| 175 |
\def\essaykit@family{ek} |
| 176 |
\definecolor{lightgray}{rgb}{0.9, 0.9, 0.9} |
| 177 |
\definecolor{softgray}{rgb}{0.7, 0.7, 0.7} |
| 178 |
\definecolor{box-color}{rgb}{0.65, 0.8, 0.85} |
| 179 |
\definecolor{darkgray}{rgb}{0.2, 0.2, 0.2} |
| 180 |
\definecolor{softblue}{RGB}{70, 130, 180} |
| 181 |
% \end{macrocode} |
| 182 |
% |
| 183 |
% \subsection{Key-Value System} |
| 184 |
% |
| 185 |
% \begin{macrocode} |
| 186 |
\define@key{ek}{color}[lightgray]{\def\ek@color{#1}} |
| 187 |
\define@key{ek}{textcolor}[black]{\def\ek@textcolor{#1}} |
| 188 |
\define@key{ek}{title}[]{\def\ek@title{#1}} |
| 189 |
\define@key{ek}{width}[\textwidth]{\def\ek@width{#1}} |
| 190 |
\setkeys{ek}{color,textcolor,title,width} |
| 191 |
% \end{macrocode} |
| 192 |
% |
| 193 |
% \begin{macro}{\rbox} |
| 194 |
% The main box command with customizable options. |
| 195 |
% \begin{macrocode} |
| 196 |
\newcommand{\rbox}[2][]{% |
| 197 |
\def\ek@title{}% |
| 198 |
\setkeys{ek}{#1}% |
| 199 |
\ifx\ek@title\empty |
| 200 |
\begin{tcolorbox}[% |
| 201 |
colback=\ek@color!10, |
| 202 |
colframe=\ek@color, |
| 203 |
width=\ek@width, |
| 204 |
arc=3.5mm, |
| 205 |
boxrule=1pt |
| 206 |
]% |
| 207 |
\color{\ek@textcolor}#2 |
| 208 |
\end{tcolorbox}% |
| 209 |
\else |
| 210 |
\begin{tcolorbox}[% |
| 211 |
colback=\ek@color!10, |
| 212 |
colframe=\ek@color, |
| 213 |
coltitle=\ek@textcolor, |
| 214 |
colbacktitle=\ek@color, |
| 215 |
title=\ek@title, |
| 216 |
width=\ek@width, |
| 217 |
arc=3.5mm, |
| 218 |
boxrule=1pt, |
| 219 |
fonttitle=\bfseries |
| 220 |
]% |
| 221 |
\color{\ek@textcolor}#2 |
| 222 |
\end{tcolorbox}% |
| 223 |
\fi |
| 224 |
} |
| 225 |
% \end{macrocode} |
| 226 |
% \end{macro} |
| 227 |
% |
| 228 |
% \subsection{Title Commands} |
| 229 |
% |
| 230 |
% \begin{macrocode} |
| 231 |
\define@key{ek}{titlecolor}[black]{\def\ek@titlecolor{#1}} |
| 232 |
\define@key{ek}{titlesize}[\Huge]{\def\ek@titlesize{#1}} |
| 233 |
\define@key{ek}{titlespacing}[0.5cm]{\def\ek@titlespacing{#1}} |
| 234 |
\setkeys{ek}{color,textcolor,title,width,titlecolor,titlesize,titlespacing} |
| 235 |
% \end{macrocode} |
| 236 |
% |
| 237 |
% \begin{macro}{\maintitle} |
| 238 |
% Creates styled main titles. |
| 239 |
% \begin{macrocode} |
| 240 |
\newcommand{\maintitle}[2][]{% |
| 241 |
\setkeys{ek}{titlecolor,titlesize,titlespacing}% |
| 242 |
\setkeys{ek}{#1}% |
| 243 |
{\ek@titlesize \bfseries \textcolor{\ek@titlecolor}{#2}}\\[\ek@titlespacing]% |
| 244 |
} |
| 245 |
% \end{macrocode} |
| 246 |
% \end{macro} |
| 247 |
% |
| 248 |
% \subsection{Quote Commands} |
| 249 |
% |
| 250 |
% \begin{macrocode} |
| 251 |
\define@key{ek}{authorcolor}[gray]{\def\ek@authorcolor{#1}} |
| 252 |
\define@key{ek}{quotesize}[\large]{\def\ek@quotesize{#1}} |
| 253 |
\define@key{ek}{quotespacing}[1em]{\def\ek@quotespacing{#1}} |
| 254 |
\setkeys{ek}{color,textcolor,title,width,titlecolor,titlesize,titlespacing,authorcolor,quotesize,quotespacing} |
| 255 |
% \end{macrocode} |
| 256 |
% |
| 257 |
% \begin{macro}{\quoter} |
| 258 |
% Creates formatted quotes with author attribution. |
| 259 |
% \begin{macrocode} |
| 260 |
\newcommand{\quoter}[3][]{ |
| 261 |
\setkeys{ek}{authorcolor,quotesize,quotespacing} |
| 262 |
\setkeys{ek}{#1} |
| 263 |
\begin{center} |
| 264 |
\ek@quotesize \textit{#2}\\[\ek@quotespacing] |
| 265 |
\normalsize \color{\ek@authorcolor} -- #3 %name of the author |
| 266 |
\end{center} |
| 267 |
} |
| 268 |
% \end{macrocode} |
| 269 |
% \end{macro} |
| 270 |
% |
| 271 |
% \subsection{divider commands} |
| 272 |
% \begin{macro}{\rrule} |
| 273 |
% Simple horizontal rule command. |
| 274 |
% \begin{macrocode} |
| 275 |
\newcommand{\rrule}{ |
| 276 |
\par\noindent\rule{\textwidth}{0.22pt} |
| 277 |
} |
| 278 |
% \end{macrocode} |
| 279 |
% \end{macro} |
| 280 |
% |
| 281 |
% \begin{macro}{\sources} |
| 282 |
% Bibliography/sources command with hyperlink support. |
| 283 |
% \begin{macrocode} |
| 284 |
\makeatletter |
| 285 |
\newcommand{\sources}[1]{ |
| 286 |
\begin{tcolorbox}[colback=white, colframe=black!90, title=\section{Lähteet}, fonttitle=\bfseries] |
| 287 |
\begin{itemize} |
| 288 |
\@for\source:=#1\do{% |
| 289 |
\item\source % |
| 290 |
}% |
| 291 |
\end{itemize} |
| 292 |
\end{tcolorbox} |
| 293 |
} |
| 294 |
\makeatother |
| 295 |
% \end{macrocode} |
| 296 |
% \end{macro} |
| 297 |
% |
| 298 |
% |
| 299 |
% \subsection{image commands} |
| 300 |
% \begin{macro}{\logo} |
| 301 |
% |
| 302 |
% \begin{macrocode} |
| 303 |
\newcommand{\logo}[2]{ |
| 304 |
\includegraphics[width=#2]{#1} |
| 305 |
} |
| 306 |
% \end{macrocode} |
| 307 |
% \end{macro} |
| 308 |
% |
| 309 |
% begin{macrocode} |
| 310 |
% \begin{macro}{\fig} |
| 311 |
% |
| 312 |
% \begin{macrocode} |
| 313 |
\newcommand{\fig}[3]{ |
| 314 |
\begin{figure}[h] |
| 315 |
\centering |
| 316 |
\includegraphics[width=#3]{#1} |
| 317 |
\caption{#2} |
| 318 |
\end{figure} |
| 319 |
} |
| 320 |
% \end{macrocode} |
| 321 |
% \end{macro} |
| 322 |
% |
| 323 |
% |
| 324 |
% |
| 325 |
|
| 326 |
% \begin{macro}{\placeright} |
| 327 |
% Position from right margin: \placeright{distance}{content} |
| 328 |
% \begin{macrocode} |
| 329 |
\newcommand{\placeright}[3]{ |
| 330 |
\begin{textblock*}{#3}(\dimexpr\paperwidth-#1-#3\relax,2cm) |
| 331 |
#2 |
| 332 |
\end{textblock*} |
| 333 |
} |
| 334 |
% \end{macrocode} |
| 335 |
% \end{macro} |
| 336 |
% |
| 337 |
% |
| 338 |
% |
| 339 |
% \begin{macro}{\placeleft} |
| 340 |
% Position from left margin: \placeleft{distance}{content}{width} |
| 341 |
% \begin{macrocode} |
| 342 |
\newcommand{\placeleft}[3]{ |
| 343 |
\begin{textblock*}{#3}(\dimexpr\paperwidth-#1-#3\relax,2cm) |
| 344 |
#2 |
| 345 |
\end{textblock*} |
| 346 |
} |
| 347 |
% \end{macrocode} |
| 348 |
% \end{macro} |
| 349 |
|
| 350 |
% |
| 351 |
% \begin{macrocode} |
| 352 |
%</package> |
| 353 |
% \end{macrocode} |
| 354 |
% |
| 355 |
% \Finale |
| 356 |
\endinput |