From e3213a11de6fddffc239fd3ff0bca72cb6a05ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bor=20Gro=C5=A1elj=20Simi=C4=87?= Date: Wed, 26 Oct 2022 18:00:49 +0200 Subject: [PATCH] template for 2022/23 --- buildtex | 30 ------------------- style.py | 2 +- tmplt.tex | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 83 insertions(+), 35 deletions(-) delete mode 100755 buildtex mode change 100644 => 100755 style.py diff --git a/buildtex b/buildtex deleted file mode 100755 index a13ce28..0000000 --- a/buildtex +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -ue - -scriptname=$0 - -usage () { - printf "Usage: %s [snippets] ...\n", "$scriptname" -} - -[ -z "$1" ] && usage && exit 1 -output=$1 -[ -z "$2" ] && usage && exit 1 -preamble=$2 -shift 2 - -tmp=$( - echo 'mkstemp(template)' | - m4 -D template="${TMPDIR:-/tmp}/tmpXXXXXX" -) - -cat "$preamble" > "$tmp" - -for file in "$@" -do - python3 style.py < "$file" >> "$tmp" - printf "%svskip 3em\n" '\' >> "$tmp" -done - -printf "%send{document}\n" '\' >> "$tmp" - -mv "$tmp" "$output" diff --git a/style.py b/style.py old mode 100644 new mode 100755 index e7f2fe6..9767401 --- a/style.py +++ b/style.py @@ -4,7 +4,7 @@ from pygments import highlight from pygments.formatters import LatexFormatter from pygments.lexers.c_cpp import CppLexer from pygments.style import Style -from pygments.token import (Keyword, Name, Comment, String, +from pygments.token import (Keyword, Name, Comment, String, Number, Operator, Punctuation) import sys diff --git a/tmplt.tex b/tmplt.tex index e27b4b3..6a3b37f 100644 --- a/tmplt.tex +++ b/tmplt.tex @@ -1,8 +1,10 @@ -\documentclass[a4paper, 12pt]{article} +\documentclass{article} \usepackage{fancyvrb} \usepackage{color} \usepackage[utf8]{inputenc} - +\usepackage[a4paper, total={6.2in, 9in}]{geometry} +\usepackage[many]{tcolorbox} +\usetikzlibrary{calc} \makeatletter \def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% @@ -96,8 +98,84 @@ \def\PYZrb{]} \makeatother +\definecolor{myblue}{RGB}{0,163,243} +\definecolor{myred}{RGB}{243, 10, 25} -\begin{document} +\tcbset{examplestyle/.style={ + breakable, + enhanced, + outer arc=4pt, + arc=4pt, + colframe=myblue, + colback=myblue!20, + attach boxed title to top left, + boxed title style={ + colback=myblue, + outer arc=4pt, + arc=4pt, + top=3pt, + bottom=3pt, + }, + fonttitle=\sffamily + } +} + +\tcbset{errorstyle/.style={ + breakable, + enhanced, + outer arc=4pt, + arc=4pt, + colframe=myred, + colback=myred!20, + attach boxed title to top left, + boxed title style={ + colback=myred, + outer arc=4pt, + arc=4pt, + top=3pt, + bottom=3pt, + }, + fonttitle=\sffamily + } +} -\section*{} +\newtcolorbox[auto counter,number within=section]{examples}[1][]{ + examplestyle, + colback=white, + title=Dodatni primeri, + overlay unbroken and first={ + \path + let + \p1=(title.north east), + \p2=(frame.north east) + in + node[anchor=west,font=\sffamily,color=myblue,text width=\x2-\x1] + at (title.east) {#1}; + } +} +\newtcolorbox[auto counter]{errors}[1][]{ + errorstyle, + colback=white, + title=Pogoste napake, + overlay unbroken and first={ + \path + let + \p1=(title.north east), + \p2=(frame.north east) + in + node[anchor=west,font=\sffamily,color=myblue,text width=\x2-\x1] + at (title.east) {#1}; + } +} + +\begin{document} +\\ +\begin{examples} +test +\the\textwidth +\end{examples} +\begin{errors}[neki] +test +\end{errors} +\end{document} -- 2.45.2