diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-16 22:20:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-16 22:20:09 +0000 |
commit | d2871f05b887f37df342f185c4162dac3abde4b3 (patch) | |
tree | 8f63d5fe804e0ee0f66a7f67bb93d5692cf3ccfd /Master | |
parent | 87bfbbe2f2976a2f84c0ba07e94a8cc3664d70b8 (diff) |
new latex package colourchange (14mar11)
git-svn-id: svn://tug.org/texlive/trunk@21741 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/colourchange/README | 76 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/colourchange/colourchangedoc.pdf | bin | 0 -> 233311 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/colourchange/colourchangedoc.tex | 93 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/colourchange/colourchange.sty | 156 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/colourchange.tlpsrc | 0 |
6 files changed, 326 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/colourchange/README b/Master/texmf-dist/doc/latex/colourchange/README new file mode 100644 index 00000000000..3138fbff337 --- /dev/null +++ b/Master/texmf-dist/doc/latex/colourchange/README @@ -0,0 +1,76 @@ +This is the README for colourchange.sty. + +Changes colour of beamer structural elements (e.g. the bars of outerthemes). +This is done either manually or automatically. + +Don't use a colour theme or full theme (which sometimes call colour themes). +You should be OK calling inner themes and outer themes separately (although some look better than others at the moment: see bottom of readme). +You need to compile twice for it to work. + +Requires packages etoolbox and calc. +Also needs some other stuff that is loaded by beamer. +Use with other classes at your own risk. + +%------------------------------ +% Summary of commands +%------------------------------ + +\selectcolourchanges{first}{second} takes two arguments: the starting colour and the final colour of the presentation. +These should be colours already understood by beamer. +Beamer uses xcolor, so you can define colours with xcolor commands and then use them in \selectcolourchanges. +That's what I do for the defaults. + +\selectmanualcolour{colour} +Changes the structure colour. +Use between frames. +Can't guarantee this won't do weird stuff if you also have slidechange or framechange on. + +Both commands also come with an american spelling version. +\selectcolorchanges and \selectmanualcolor are defined to be the same as the above two commands. +%------------------------------ +% Summary of options +%------------------------------ + +defaultstyle +Turns on default inner and outerthemes. +Or rather, it will do soon. +That is, it turns on my favourite version of the theme, not the "beamer default" ones. +This is just a shortcut for: +\useoutertheme[footline=authorinstitutetitle]{miniframes} +\useinnertheme{rectangles} +Simple. + +draft +The draft option turns off colour changing. +Good for speeding up compilation when drafting. + +slidechange +Colour changes every slide. + +framechange +Colour changes every frame. + +%------------------------------ +% To do list +%------------------------------ + +Make sure it works with all base inner/outer themes. + - smoothbars, smoothtree do some shading-fu that breaks colourchange.sty's basic approach. +Check it doesn't hopelessly break article or handout modes +Make a .dtx + +%------------------------------ +% Other stuff +%------------------------------ + +Currently licensed under GPL v3. http://www.gnu.org/licenses/gpl-3.0.html + +Original author and current maintainer: Seamus Bradley +tex@seamusbradley.net + +Many thanks to the tex.stackexchange.com community for their help. +In particular, TH's answer to this question: +http://tex.stackexchange.com/q/7126/215 + +And Herbert's answer to this question: +http://tex.stackexchange.com/q/7427/215 diff --git a/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.pdf b/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.pdf Binary files differnew file mode 100644 index 00000000000..af01cfa3e73 --- /dev/null +++ b/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.pdf diff --git a/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.tex b/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.tex new file mode 100644 index 00000000000..4a01434bedb --- /dev/null +++ b/Master/texmf-dist/doc/latex/colourchange/colourchangedoc.tex @@ -0,0 +1,93 @@ +\documentclass{scrartcl} + %Warning: I use a modified vc script so this will not compile unless you remove the \GITTag from the footer or download the modified version from my website. +\immediate\write18{./vc} +\input{vc} +\usepackage[T1]{fontenc} +\usepackage{scrpage2} +\pagestyle{scrheadings} +\setkomafont{pagefoot}{\small\normalfont\sffamily} +\ifoot[\GITTag\ \VCDateISO]{\GITTag\ \VCDateISO} +\ofoot[\GITAbrHash]{\GITAbrHash} +\usepackage{microtype} +\usepackage{url} +\usepackage{libertine} +\usepackage{inconsolata} +\author{Seamus Bradley} +\title{The colourchange package} +\usepackage{listings} +\lstloadlanguages{[LaTeX]TeX} % I need to tell listings how I want code typeset. Here come some options: +\lstset{% + basicstyle=\ttfamily\small, + commentstyle=\itshape\ttfamily\small, + showspaces=false, + showstringspaces=false, + breaklines=true, + breakautoindent=true, + captionpos=t, + frame=single, + escapeinside={(*}{*)}, +} +\begin{document} +\maketitle + +\vspace{-2\normalbaselineskip} +\begin{center} + \small \url{tex@seamusbradley.net}\\ + \url{http://www.seamusbradley.net/tex.php} +\end{center} + +\section{Introduction} + +The \lstinline+colourchange+ package provides options for changing the colour of beamer's structural elements. +There are two ways to do this: manual and automatic. + +\section{Manual} + +The command \lstinline+\selectmanualcolour+ sets the colour to its argument. +It accepts any named colour understood by \lstinline+xcolor+. + +\section{Automatic} + +There are two options that automatically change the colour: \lstinline+slidechange+ and \lstinline+framechange+. +Pass one of these to the package as an option and the colour of the structure will slowly change from one colour to another. +To set what colours the transition should be between, use: \lstinline+\selectcolourchange{first}{second}+ which makes the colour transition from + \lstinline+first+ to \lstinline+second+ over the course of the presentation. + +You will need to compile twice to see the effect since \lstinline+colourchange+ needs to know how many slides there are so it knows how far + through the presentation it is at a given point. + +\section{Usage} +I have been testing this by calling it as a standard package, I'm not sure how \lstinline+\usecolortheme+ deals with package options. +So if you want to use the manual colour changing option, all you need is: \lstinline+\usepackage{colourchange}+. +If you want one of the automatic colourchange options call \lstinline+\usepackage[slidechange]{colourchange}+ or + \lstinline+\usepackage[framechange]{colourchange}+. + +You can pass the option \lstinline+defaultstyle+ to the package, this sets up the structural elements (the inner and outer theme) so that they use the colours. +Otherwise, you can use Beamer's own \lstinline+\useinnnertheme+ and \lstinline+\useoutertheme+ to use the themes Beamer defines. +Call inner and outer themes separately. +Some ``all inclusive'' themes call a colour theme themselves and this can lead to only some elements changing colour. + +Use the \lstinline+draft+ option to turn off the colour transitions. + +\section{Known problems} + +The \lstinline+smoothbars+ and \lstinline+smoothtrees+ outer themes do some funky stuff with shading and colours, so they aren't currently supported. +All other outer and inner themes looked alright. +Testing was, however, pretty basic: not all combinations were tested. + +\section{How it works} + +It's a pretty simple package really. +Just like (some) basic beamer colour themes it defines all the components of the inner and outer themes + in terms of one ``master colour'' called \lstinline+structure+. +Then all it does is use various ways of changing this colour. +The manual option just gives you a way of changing this colour on the fly. +The two automatic ways basically fiddle with beamer slide and frame creation internals to set the structure colour whenever a new frame/slide is created. +See the \lstinline+.sty+ file for details. + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: diff --git a/Master/texmf-dist/tex/latex/colourchange/colourchange.sty b/Master/texmf-dist/tex/latex/colourchange/colourchange.sty new file mode 100644 index 00000000000..f53715295bf --- /dev/null +++ b/Master/texmf-dist/tex/latex/colourchange/colourchange.sty @@ -0,0 +1,156 @@ +% This is the colour change package. +% By Seamus Bradley 2011. +% tex@seamusbradley.net +% Licensed under GPLv3. +% http://www.gnu.org/licenses/gpl-3.0.html + +%% +\ProvidesPackage{colourchange}[2011/03/15 v1.22] +\RequirePackage{etoolbox} +\RequirePackage{calc} + +% Some new ifs I use + +\newif\ifclch@defaultstyle +\newif\ifclch@slidechange +\newif\ifclch@framechange +\newif\ifclch@draft +\newif\ifclch@final + +% The default behaviour is "do nothing" + +\DeclareOption{defaultstyle}{% +\clch@defaultstyletrue% +} + +\DeclareOption{slidechange}{ +\clch@slidechangetrue +\clch@framechangefalse +} + +\DeclareOption{framechange}{ +\clch@framechangetrue +\clch@slidechangefalse +} + +\DeclareOption{draft}{ +\clch@drafttrue +} + +\DeclareOption{final}{ +\clch@finaltrue +} + +\ProcessOptions\relax + +% Default option + +\ifclch@defaultstyle +\useoutertheme[footline=authorinstitutetitle]{miniframes} +\useinnertheme{rectangles} +\fi + + +% This chunky command basically makes sure that all the colours are set each time the structure colour changes. + +\newcommand\setcolours{% +\setbeamercolor*{palette primary}{use=structure,fg=white,bg=structure.fg} +\setbeamercolor*{palette secondary}{use=structure,fg=white,bg=structure.fg!75!black} +\setbeamercolor*{palette tertiary}{use=structure,fg=white,bg=structure.fg!50!black} +\setbeamercolor*{palette quaternary}{fg=white,bg=structure.fg!80!black} +\setbeamercolor*{sidebar}{use=structure,bg=structure.fg} +\setbeamercolor*{palette sidebar primary}{use=structure,fg=structure.fg!10} +\setbeamercolor*{palette sidebar secondary}{fg=white} +\setbeamercolor*{palette sidebar tertiary}{use=structure,fg=structure.fg!50} +\setbeamercolor*{palette sidebar quaternary}{fg=white} +\setbeamercolor*{titlelike}{parent=palette primary} +\setbeamercolor{itemize item}{bg=structure} +\setbeamercolor*{block title}{bg=structure.fg,fg=white} +\setbeamercolor*{block body}{bg=structure.fg!50!white} +} + +%------------------------------ +% Manual change command +%------------------------------ + +\newcommand\selectmanualcolour[1]{% + \setbeamercolor{structure}{fg=#1}% + \setcolours +} + +\let\selectmanualcolor\selectmanualcolour + +% All the work is bascially done by a few counters +% Some are for with the slidechange option, and some for the frame change option +% I'll let you guess which are which. + +\newcounter{clch@slidefrac} +\newcounter{clch@slidetot} +\newcounter{clch@currslide} +\setcounter{clch@currslide}{1} + +\newcounter{clch@framefrac} +\newcounter{clch@frametot} +\newcounter{clch@currframe} +\setcounter{clch@currframe}{1} + +% At the start of each slide, step the counter, and set the fraction counter +% Only if the draft mode is off. +\ifclch@draft +\renewcommand\selectmanualcolour[1]{} +\renewcommand\selectmanualcolor[1]{} +\else +\ifclch@slidechange + + \newcommand\fractionate{ + \setcounter{clch@slidetot}{\inserttotalslidenumber} + \setcounter{clch@slidefrac}{100 * \value{clch@currslide} / \value{clch@slidetot}} + } + + \def\beamer@checkframetitle{\stepcounter{clch@currslide}% + \fractionate% + \@ifnextchar\bgroup\beamer@inlineframetitle{}} + + \fi + + \ifclch@framechange + \newcommand\fractionate{ + \setcounter{clch@slidetot}{\inserttotalframenumber} + \setcounter{clch@slidefrac}{100 * \insertframenumber / \value{clch@slidetot}} + } + + \preto\frame{\fractionate\setcolours} + \fi +\fi + +% This command sets the fraction counter for the above command. +% Why do I have to set clch@slidetot here too? Well, if I put it in \AtBeginDocument, it seems to break... +% \inserttotalslidenumber is defined at the end (lines 61 et seq.) + +% The colour setting commands don't like having counter names in them directly, so this workaround is necessary... + +\definecolor{dred}{rgb}{0.9,0.15,0.15} +\def\first@colour{blue} +\def\second@colour{dred} +\newcommand\setstruccol[1]{% + \setbeamercolor*{structure}{fg=\second@colour!#1!\first@colour} +} + +\newcommand\setstruccolx{\setstruccol{\the\value{clch@slidefrac}}} + +\newcommand\selectcolourchanges[2]{% + \def\first@colour{#1}% + \def\second@colour{#2}} +\let\selectcolorchanges\selectcolourchanges + +% At the beginning of the document, we need to set the colours up for the first time... + +\AtBeginDocument{\setstruccolx \setcolours} + +% We need to know how many slides there are, so I just ripped off the way beamer defines \inserttotalframenumber + +\def\inserttotalslidenumber{1} +\AtEndDocument{ + \immediate\write\@auxout{\string\@writefile{nav}% + {\noexpand\headcommand{\noexpand\def\noexpand\inserttotalslidenumber{\the\value{clch@currslide}}}}} +} diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index a36d9fc6627..50183f4af41 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -111,6 +111,7 @@ depend colordoc depend colorinfo depend colortab depend colorwav +depend colourchange depend combelow depend combine depend comma diff --git a/Master/tlpkg/tlpsrc/colourchange.tlpsrc b/Master/tlpkg/tlpsrc/colourchange.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/colourchange.tlpsrc |