Command to put string in both the LyX authoring environment and the finished PDF? <SOLVED BY WORKAROUND>

Richard Kimberly Heck rikiheck at
Tue Jun 22 15:16:56 UTC 2021

On 6/22/21 10:05 AM, Steve Litt wrote:
> Steve Litt said on Sun, 20 Jun 2021 17:39:52 -0400
>> Hi all,
>> I have a local layout, based on Book-extsizes, for my new book. I have
>> no idea what the book's title will be yet, and I sure nuff don't want
>> to have to search all instances of that title and replace them every
>> time I get a better idea for the title.
>> Soooo, what I want to do is put something in my local layout to
>> articulate the title, both in the LyX authoring environment and in the
>> compiled PDF, showing the title in a specific appearance. I tried to do
>> it as a character style, as follows:
>> ========================================================================
>> \definecolor{titlebodytextcolor}{HTML}{cc0000}
>> % ### Character style for book title within body text
>> \newcommand{\chartitlebodytextL}[0]{{\color{titlebodytextcolor}My
>> Current Title As Of Today}}%
>> CharStyle CharTitleInBody
>> Font
>> 	Series	Bold
>> 	Color   Red
>> EndFont
>> LabelFont
>> 	Series	Bold
>> 	Size    Larger
>> 	Color   Red
>> EndLabelFont
>> LatexName	chartitlebodytextL
>> LatexType	Command
>> LabelString     "My Current Title As Of Today"
>> End
>> ========================================================================
>> If I apply the character style CharTitleInBody to an empty string in
>> LyX, the exact right thing happens in the PDF, but in the LyX
>> authoring environment the title appears under the character style inset
>> and also under the following text, which is very disturbing if you're
>> trying to copy-edit your book in the LyX environment.
>> Does anybody know what I can do to make the text appear inline, instead
>> of underneath, within the LyX authoring environment?
> My workaround is as follows:
> I changed the [0] number of arguments in the LaTeX command to [1] in
> order to consume the argument. Once I did that, whatever I put in the
> character style does not show up in the PDF.

There's a long-standing request for non-math macros, which is exactly
what's needed here. Someday when I have time to work on LyX again, I
might take that on.


More information about the lyx-users mailing list