Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- makeatletter
- newenvironment*{sidebar}[3][0.5textwidth]
- {
- % less vertical margin around wrapfigures
- setlength{intextsep}{0pt}
- colorlet{savedcolor}{inline code}
- colorlet{inline code}{inline code inverted}
- renewcommand{dummy}{#1}
- wrapfigure{#2}{#1}
- renewcommand{@currentlabel}{#3}
- renewcommand{@currentlabelname}{#3}
- phantomsection
- rule{#1}{1pt}
- rule{#1}{18pt}
- vspace{-18pt}
- centerline{textcolor{white}{#3}}
- vspace{5pt}
- footnotesize
- leftskip=5pt
- rightskip=5pt
- setlength{parskip}{0.2cm}
- setlength{parindent}{0pt}
- % restore the inline code color for the body of the bar
- colorlet{inline code}{savedcolor}
- }
- {
- leftskip=0pt
- rightskip=0pt
- setlength{parindent}{0pt}
- rule{dummy}{1pt}
- rule[.19in]{dummy}{2.5pt}
- endwrapfigure
- }
- makeatother
- % !TEX program = xelatex
- documentclass{scrbook}
- usepackage{wrapfig}
- usepackage{graphicx}
- usepackage{xcolor}
- usepackage{tcolorbox}
- usepackage{listings}
- usepackage{blindtext}
- usepackage{hyperref}
- definecolor{inline code}{RGB}{194,61,53}
- definecolor{inline code inverted}{RGB}{193,153,151}
- newcommand*{code}{lstinline[basicstyle=fontsize{9}{11}ttfamilycolor{inline code},keywordstyle=color{inline code},stringstyle=color{inline code},keepspaces=true]}
- newtcolorbox{cbar}[2][]{
- parbox=false, % normal paragraph spacing
- height from=2.5cm to 100cm,
- halign=justify,
- sharp corners,
- colframe=black,
- colback=black!15!white,
- fontupper=tiny,% font size for body of text
- title=scriptsize textsc{#2},
- #1
- }
- begin{document}
- begin{cbar}[label=lab:testing]{Test Bar (some code{Code})}
- Here is a test bar with some code{Code}.
- blindtext
- end{cbar}
- Hello, code{code}. And here is a reference to ref{lab:testing}, which has name nameref{lab:testing}.
- end{document}
Add Comment
Please, Sign In to add comment