Tag Info

New answers tagged

4

Key filtering is intended for rather specialised cases where multiple keys make sense but need additional processing or ordering. In particular, it is not really the correct approach to handling keys where from some fixed point onward they no longer make sense. For example, many packages have preamble-only options which affect an entire document: these keys ...


1

Here's one possibility, using keyval to handle the key: \documentclass[twocolumn]{article} \usepackage{keyval} \usepackage{lipsum} \def\titlemark#1{} \def\authormark#1{} \makeatletter \define@key{ShortTitleKey}{shorttitle}{\markright{#1}} \long\def\title{\@ifnextchar[{\short@title}{\@@title}} \def\short@title[#1]{{\setkeys{ShortTitleKey}{#1}}\@@@title} ...


7

listings allow you to define styles that you can apply to individual listings with style=<stylename>. \documentclass{article} \usepackage{listings,xcolor} \lstdefinestyle{style1}{basicstyle=\ttfamily\color{red}} \lstdefinestyle{style2}{basicstyle=\scshape\color{blue},frame=single} \lstnewenvironment{mycodebox}[1][] ...


7

The expansion of the content of the optional argument #1 has to be postponed, otherwise the macro \optionstocodebox is expanded, letting keyval macros think its content is a complete key name, which isn't, of course. Using \begingroup\edef\x{\endgroup\noexpand\lstset{numbers=right,language={C},#1}}\x will prevent premature expansion and expands it ...



Top 50 recent answers are included