Michael Gerz wrote: > Herbert Voss schrieb: >> Michael Gerz wrote: >> >> >>> does anybody know why the following LaTeX construct (soul + xcolor) does >>> not work: >>> >>> \st{\textcolor{red}{hello world}}} >>> >>> Error message: >>> >>> Package xcolor Error: Undefined color `{red}'. >>> ... >>> file:///C:/Dokumente%20und%20Einstellungen/ms/Eigene%20Dateien/ct-test.tex >>> <cid:part1.00020208.06010809@teststep.org> >>> It seems like soul is very picky about its arguments. If nobody knows a >>> better solution, I am going to define \setstcolor{red} and drop the >>> xcolor package. >>> >> >> ??? huh it is only a moving argument ... >> the error message says it all: a color {red} is not defined, including >> the parenthesis-> the argument was expanded, but shouldn't ... >> >> \st{\protect\textcolor{red}{hello world}} >> > Thanks, Herbert. > > I changed the macro accordingly but I still don't get the desired result. > > Please have a look at the attached TeX file. I would expect to see some > striked out text but in fact the text is just colored. > > Any idea what goes wrong? > > Michael > > > PS: changebar.sty fails if it is used inside a \section{} or \caption{}. > Do think that \protect will also help in this case?
yes, all non robust macros will fail as argument in another macro. > %% LyX 1.5.0svn created this file. For more info, see http://www.lyx.org/. > %% Do not edit unless you really know what you are doing. > \documentclass[english]{article} > \usepackage[T1]{fontenc} > \usepackage[latin9]{inputenc} > \usepackage{soul} > \usepackage{xcolor} > > \makeatletter > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. > \newcommand{\lyxinserted}[1]{\textcolor{blue}{#1}} > \newcommand{\lyxdeleted}[1]{\st{\protect\textcolor{red}{#1}}} try the other way round \newcommand{\lyxdeleted}[1]{\textcolor{red}{\st{#1}}} Herbert