Introduce colored boxes
This commit is contained in:
parent
8c402e6d65
commit
10c23c7294
|
@ -0,0 +1 @@
|
||||||
|
../tutorial/colored-blocks.lua
|
|
@ -0,0 +1 @@
|
||||||
|
../tutorial/virli.sty
|
|
@ -0,0 +1,47 @@
|
||||||
|
function Div(el)
|
||||||
|
if el.classes[1] == "warning"
|
||||||
|
then
|
||||||
|
-- insert element in front
|
||||||
|
table.insert(
|
||||||
|
el.content, 1,
|
||||||
|
pandoc.RawBlock("latex", "\\begin{alertbox}"))
|
||||||
|
-- insert element at the back
|
||||||
|
table.insert(
|
||||||
|
el.content,
|
||||||
|
pandoc.RawBlock("latex", "\\end{alertbox}"))
|
||||||
|
|
||||||
|
elseif el.classes[1] == "code"
|
||||||
|
then
|
||||||
|
-- insert element in front
|
||||||
|
table.insert(
|
||||||
|
el.content, 1,
|
||||||
|
pandoc.RawBlock("latex", "\\begin{codebox}"))
|
||||||
|
-- insert element at the back
|
||||||
|
table.insert(
|
||||||
|
el.content,
|
||||||
|
pandoc.RawBlock("latex", "\\end{codebox}"))
|
||||||
|
|
||||||
|
elseif el.classes[1] == "question"
|
||||||
|
then
|
||||||
|
-- insert element in front
|
||||||
|
table.insert(
|
||||||
|
el.content, 1,
|
||||||
|
pandoc.RawBlock("latex", "\\begin{questionbox}"))
|
||||||
|
-- insert element at the back
|
||||||
|
table.insert(
|
||||||
|
el.content,
|
||||||
|
pandoc.RawBlock("latex", "\\end{questionbox}"))
|
||||||
|
|
||||||
|
elseif el.classes[1] == "more"
|
||||||
|
then
|
||||||
|
-- insert element in front
|
||||||
|
table.insert(
|
||||||
|
el.content, 1,
|
||||||
|
pandoc.RawBlock("latex", "\\begin{morebox}"))
|
||||||
|
-- insert element at the back
|
||||||
|
table.insert(
|
||||||
|
el.content,
|
||||||
|
pandoc.RawBlock("latex", "\\end{morebox}"))
|
||||||
|
end
|
||||||
|
return el
|
||||||
|
end
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
\usepackage{etoolbox}
|
\usepackage{etoolbox}
|
||||||
|
|
||||||
% Declare coloredbox
|
\usepackage{tcolorbox}
|
||||||
\newcommand{\coloredbox}[2]{#2}
|
\usepackage{../virli}
|
||||||
|
|
||||||
\makeatletter
|
\makeatletter
|
||||||
\pretocmd{\subsection}{\addtocontents{toc}{\protect\addvspace{-5\p@}}}{}{}
|
\pretocmd{\subsection}{\addtocontents{toc}{\protect\addvspace{-5\p@}}}{}{}
|
||||||
|
|
|
@ -14,4 +14,5 @@ PANDOCOPTS = --pdf-engine=lualatex \
|
||||||
-M indent=true \
|
-M indent=true \
|
||||||
-V toc-title="Sommaire" \
|
-V toc-title="Sommaire" \
|
||||||
-V pdfa \
|
-V pdfa \
|
||||||
|
--lua-filter=../colored-blocks.lua \
|
||||||
--include-in-header=../../tutorial/header.tex
|
--include-in-header=../../tutorial/header.tex
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
\tcbuselibrary{skins,breakable}
|
||||||
|
\newtcbox{\section@box}{tile,before=\noindent,after=,
|
||||||
|
fontupper=\normalfont\Large\bfseries,capture=minipage,colback=ForestGreen!80,coltext=white,
|
||||||
|
boxsep=0mm,top=4mm,bottom=4mm,left=\oddsidemargin+1in,right=\oddsidemargin+1in,
|
||||||
|
spread sidewards,fuzzy halo=1mm with ForestGreen!50!black}
|
||||||
|
|
||||||
|
\renewcommand\section{\@startsection{section}{1}{\z@}{\z@}{5mm}{\section@box}}
|
||||||
|
|
||||||
|
\newtcolorbox{alertbox}[1][]{breakable,enhanced,
|
||||||
|
before skip balanced=2mm,after skip balanced=3mm,
|
||||||
|
tile,left=11mm,right=2mm,top=1mm,bottom=1mm,
|
||||||
|
colback=white!0,
|
||||||
|
sharp corners,
|
||||||
|
underlay={%
|
||||||
|
\path[fill=OrangeRed!80!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=10mm]interior.north west);
|
||||||
|
},#1}
|
||||||
|
|
||||||
|
\newtcolorbox{codebox}[1][]{breakable,enhanced,
|
||||||
|
before skip balanced=2mm,after skip balanced=3mm,
|
||||||
|
tile,left=11mm,right=2mm,top=1mm,bottom=1mm,
|
||||||
|
colback=white!0,
|
||||||
|
sharp corners,
|
||||||
|
underlay={%
|
||||||
|
\path[fill=black,draw=none] (interior.south west) rectangle node[white]{\huge\bfseries\texttt >\_} ([xshift=10mm]interior.north west);
|
||||||
|
},#1}
|
||||||
|
|
||||||
|
\newtcolorbox{questionbox}[1][]{breakable,enhanced,
|
||||||
|
before skip balanced=2mm,after skip balanced=3mm,
|
||||||
|
tile,left=11mm,right=2mm,top=1mm,bottom=1mm,
|
||||||
|
colback=white!0,
|
||||||
|
sharp corners,
|
||||||
|
underlay={%
|
||||||
|
\path[fill=MidnightBlue!85!gray,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries ?} ([xshift=10mm]interior.north west);
|
||||||
|
},#1}
|
||||||
|
|
||||||
|
\newtcolorbox{morebox}[1][]{breakable,enhanced,
|
||||||
|
before skip balanced=2mm,after skip balanced=3mm,
|
||||||
|
tile,left=7mm,right=7mm,top=1mm,bottom=1mm,
|
||||||
|
colback=white!0,
|
||||||
|
sharp corners,
|
||||||
|
underlay={%
|
||||||
|
\path[fill=ForestGreen!50!white,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries (} ([xshift=6mm]interior.north west);
|
||||||
|
\path[fill=ForestGreen!50!white,draw=none] (interior.south east) rectangle node[white]{\Huge\bfseries )} ([xshift=6mm]interior.north east);
|
||||||
|
},#1}
|
Loading…
Reference in New Issue