diff --git a/cheatsheet.sty b/cheatsheet.sty index 6f2ba26..58efbce 100644 --- a/cheatsheet.sty +++ b/cheatsheet.sty @@ -40,6 +40,8 @@ \RequirePackage{fancyhdr} % Needed to get last page of document \RequirePackage{lastpage} +% Tables +\usepackage{tabularx} %------------------------------------------------------------------------------- % Configuration for options @@ -98,6 +100,11 @@ % bottom bar \renewcommand{\footrulewidth}{0pt} +%%% Tables +\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} +\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} +\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}} + %%% Code Listings \lstdefinestyle{mystyle}{ backgroundcolor=\color{codeback}, % choose the background color; @@ -138,19 +145,47 @@ % define new colorboxes \newtcolorbox{hintBox}{textmarker, - borderline west={6pt}{0pt}{yellow}, + borderline west={4pt}{0pt}{yellow}, colback=yellow!10!white} \newtcolorbox{importantBox}{textmarker, - borderline west={6pt}{0pt}{red}, + borderline west={4pt}{0pt}{red}, colback=red!10!white} \newtcolorbox{noteBox}{textmarker, - borderline west={3pt}{0pt}{green}, + borderline west={4pt}{0pt}{green}, colback=green!10!white} + \newtcolorbox{redbox}{leftrule=3mm, + colback=red!5!white,colframe=red!75!black + } + % define new text higlights + \newtcbox{\lhigh}[1][red]{on line, arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black, boxsep=0pt,left=0pt,right=0pt,top=1pt,bottom=1pt, boxrule=0pt,bottomrule=1pt,toprule=1pt} + \newtcbox{\rhigh}[1][red]{on line, arc=7pt,colback=#1!10!white,colframe=#1!50!black, before upper={\rule[-3pt]{0pt}{10pt}},boxrule=.5pt, boxsep=0pt,left=2.5pt,right=2.5pt,top=0pt,bottom=0pt} % define commands for easy access \renewcommand{\note}[2]{\begin{noteBox} \textbf{#1} #2 \end{noteBox}} -\newcommand{\warning}[1]{\begin{hintBox} \textbf{Warning:} #1 \end{hintBox}} -\newcommand{\important}[1]{\begin{importantBox} \textbf{Important:} #1 \end{importantBox}} +\newcommand{\warning}[2]{\begin{hintBox} \textbf{#1} #2 \end{hintBox}} +\newcommand{\important}[2]{\begin{importantBox} \textbf{#1} #2 \end{importantBox}} +\newcommand{\headnote}[2]{ + \begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=#1] #2 \end{tcolorbox} +} +\newcommand{\headcenternote}[2]{ + \newtcolorbox{mybox}[2][]{colback=red!5!white, + colframe=red!75!black,fonttitle=\bfseries, + colbacktitle=red!85!black,enhanced, + attach boxed title to top center={yshift=-2mm}, + title={#2},#1} + \begin{mybox}[colback=yellow]{#1} #2 \end{mybox} +} + +% define cardbox +\newcommand{\flashcard}[4]{ + \vspace{.1cm} + \fbox{\parbox[t][1in][c]{2in}{% + \footnotesize\textsc{#1}\par\vspace*{\fill}\par + \centerline{\textbf{#2}}\par\vspace*{\fill}\par + \hspace*{\fill}\textsc{#3}}} + \fbox{\parbox[t][1in][c]{2in}{% + \footnotesize\vspace*{\fill}\par\begin{center} #4 \end{center}\par\vspace*{\fill}}} + } % Redefine section commands to use less space \makeatletter diff --git a/sample.pdf b/sample.pdf index 5076568..d360cb9 100644 --- a/sample.pdf +++ b/sample.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8aa6697f84f39ccd7f74612ec54772c9f99315649042450aa9d40aaab00c1ae4 -size 162479 +oid sha256:2c3a05b5f55f973c46083e91b5aaf3948959ffef36cefb9b109093b32da0314c +size 258824 diff --git a/sample.tex b/sample.tex index 26933b2..898652d 100644 --- a/sample.tex +++ b/sample.tex @@ -9,8 +9,13 @@ \begin{multicols}{3}\scriptsize - \section{Introduction} - \subsection{Lists} + \section{Section} + \subsection{Subsection} + \subsubsection{Subsubsection} + \paragraph{Paragraph} + Some random text to show minimum space required. This is only an example, everybody who reads this does it to his own harm. We can write here a lot of stuff but it really is only for demonstration. + + \section{Lists} % use * to reduce required space Item lists \begin{itemize*} @@ -39,25 +44,37 @@ \section{Boxes} - \note{Note Title}{This is a little but helpful note you can use to highlight informations} + \note{Title}{This is a little but helpful note you can use to highlight informations} - \warning{This is a warning box. Warning always prepend ,,Warning''.} + \note{}{Not all notes need captions.} - \important{This might be something important to remember! Therefore it prepends ,,Important''} + \warning{Warning}{This is a warning box.} + \warning{}{This is a another warning.} - \begin{tabular}{r|p{0.8\textwidth}}\scriptsize - 84 & \href{http://www.gutenberg.org/ebooks/84}{Frankenstein; Or, The Modern Prometheus by Mary Wollstonecraft Shelley} \\ - 6087 & \href{https://www.gutenberg.org/ebooks/6087}{The Vampyre; a Tale by John William Polidori} \\ - 696 & \href{https://www.gutenberg.org/ebooks/696}{The Castle of Otranto by Horace Walpole} \\ - 42 & \href{https://www.gutenberg.org/ebooks/42}{The Strange Case of Dr. Jekyll and Mr. Hyde by Robert Louis Stevenson} - \end{tabular} - - \columnbreak + \important{Important}{This might be something important to remember!} + + \important{}{Some important boxes don't need caption} + + \headnote{Notes can have titles}{And a text below.} + + \headnote{}{This note has no title} + + \newtcbox{\mynewbox}[1][red]{on line, + arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black, + boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt, + boxrule=0pt,bottomrule=1pt,toprule=1pt} + \newtcbox{\xmybox}[1][red]{on line, + arc=7pt,colback=#1!10!white,colframe=#1!50!black, + before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt, + boxsep=0pt,left=6pt,right=6pt,top=2pt,bottom=2pt} + + Need to \lhigh{highlight} some \lhigh[green]{words} in your text? \rhigh{Now} possible in \rhigh[blue]{two different} styles. + + \columnbreak \section{Code} \begin{lstlisting} - main(void){ for(int i=0; i<10; i++ ){ //do something here @@ -70,11 +87,31 @@ \section{Tables} \begin{tabular}{l|c|r} - Nr & Sign & Code \\\hline - 1 & $\Omega$ & $\backslash$Omega \\ - 2 & $\Theta$ & $\backslash$Theta \\ - 3 & $\rho$ & $\backslash$rho + Nr & Sign & Code \\\hline + 1 & $\Omega$ & $\backslash$Omega \\ + 2 & $\Theta$ & $\backslash$Theta \\ + 3 & $\rho$ & $\backslash$rho + \end{tabular} + + \begin{tabular}{L{0.1\linewidth}|R{0.8\linewidth}}\scriptsize + 84 & \href{http://www.gutenberg.org/ebooks/84}{Frankenstein; Or, The Modern Prometheus by Mary Wollstonecraft Shelley} \\ + 6087 & \href{https://www.gutenberg.org/ebooks/6087}{The Vampyre; a Tale by John William Polidori} \\ + 696 & \href{https://www.gutenberg.org/ebooks/696}{The Castle of Otranto by Horace Walpole} \\ + 42 & \href{https://www.gutenberg.org/ebooks/42}{The Strange Case of Dr. Jekyll and Mr. Hyde by Robert Louis Stevenson} \end{tabular} \end{multicols} + + +\flashcard{Definition}{Your Question?}{Maybe a theme?}{This is the answer to your Question} +\flashcard{}{Minimal Example}{}{Here is very little text} + +\flashcard{}{Print a List}{This could be a hint}{You can fully configure the back: + \begin{itemize} + \item Test + \item Two + \item Three + \end{itemize} +} + \end{document} \ No newline at end of file