Skip to content

Commit

Permalink
Add tex for sidebars
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Oct 12, 2020
1 parent cd93d22 commit e325790
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,27 @@
\newunicodechar{├}{\textfallback{├}}
\newunicodechar{│}{\textfallback{│}}


% sidebar environment
\usepackage{framed,color}
\definecolor{shadecolor}{RGB}{242,242,242}
\makeatletter
\newenvironment{sidebar}{%
\medskip{}
\setlength{\fboxsep}{.8em}
\def\at@end@of@kframe{}%
\ifinner\ifhmode%
\def\at@end@of@kframe{\end{minipage}}%
\begin{minipage}{\columnwidth}%
\fi\fi%
\def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
\colorbox{shadecolor}{##1}\hskip-\fboxsep
% There is no \\@totalrightmargin, so:
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
\MakeFramed {\advance\hsize-\width
\@totalleftmargin\z@ \linewidth\hsize
\@setminipage}}%
{\par\unskip\endMakeFramed%
\at@end@of@kframe}
\makeatother

0 comments on commit e325790

Please sign in to comment.