summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty')
-rw-r--r--Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty71
1 files changed, 71 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty b/Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty
new file mode 100644
index 00000000000..66f42ab2c96
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/lstaddons/lstlinebgrd.sty
@@ -0,0 +1,71 @@
+
+
+%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% ----------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files lstlinebgrd.dtx and lstladdons.ins
+%% and the derived filebase lstlinebgrd.sty.
+%%
+\ProvidesPackage{lstlinebgrd}[%
+ 2012/05/03
+ v0.1
+ Provides 'listings' options to color the background of lines]
+\RequirePackage{listings}
+\RequirePackage{xcolor}
+
+\lst@Key{numbers}{none}{%
+ \def\lst@PlaceNumber{\lst@linebgrd}%
+ \lstKV@SwitchCases{#1}%
+ {none&\\%
+ left&\def\lst@PlaceNumber{\llap{\normalfont
+ \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}\lst@linebgrd}\\%
+ right&\def\lst@PlaceNumber{\rlap{\normalfont
+ \kern\linewidth \kern\lst@numbersep
+ \lst@numberstyle{\thelstnumber}}\lst@linebgrd}%
+ }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
+
+\lst@Key{linebackgroundcolor}{}{%
+ \def\lst@linebgrdcolor{#1}%
+}
+\lst@Key{linebackgroundsep}{0pt}{%
+ \def\lst@linebgrdsep{#1}%
+}
+\lst@Key{linebackgroundwidth}{\linewidth}{%
+ \def\lst@linebgrdwidth{#1}%
+}
+\lst@Key{linebackgroundheight}{\ht\strutbox}{%
+ \def\lst@linebgrdheight{#1}%
+}
+\lst@Key{linebackgrounddepth}{\dp\strutbox}{%
+ \def\lst@linebgrddepth{#1}%
+}
+\lst@Key{linebackgroundcmd}{\color@block}{%
+ \def\lst@linebgrdcmd{#1}%
+}
+
+\newcommand{\lst@linebgrd}{%
+ \ifx\lst@linebgrdcolor\empty\else
+ \rlap{%
+ \lst@basicstyle
+ \color{-.}% By default use the opposite (`-`) of the current color (`.`) as background
+ \lst@linebgrdcolor{%
+ \kern-\dimexpr\lst@linebgrdsep\relax%
+ \lst@linebgrdcmd{\lst@linebgrdwidth}{\lst@linebgrdheight}{\lst@linebgrddepth}%
+ }%
+ }%
+ \fi
+}
+\endinput
+%%
+%% End of file `lstlinebgrd.sty'.