I'm migrating from standard LaTeX to LyX and I'm having issues with using \newcommand.

I like to leave around my texts some highlighted red texts (the idea is that I should fix something afterwards). I've done this in Latex just by including \newcommand{\replace}[1]{{\bf\color{red}{#1}}} and afterwards just write \replace{ Confirm this ! } to leave the message.

I'm not being able to find on the internet a way of creating a "non-math" command with an input in LyX. Is there a way?

Thanks !

  • Funny thing is that I migrated from LyX to LaTeX because I found LyX to be too confining. Interesting to see someone "migrating" the other way. – A Feldman Mar 16 '16 at 14:14
  • 1
    It's because it seems to be faster to write, and two of my collaborators want me to try it out. It actually seems way faster and simpler, you are right about the restriction part, but I do not need all the time to do incredibly complex things, and time is expensive. – pancho Mar 16 '16 at 18:09
  • 1
    @FranciscoJoseRomeroHinrichs I've accomplished a similar task by using the TODO notes module in LyX (the FIXME module is also worth taking a look at). It is only available for 2.2.0 (see wiki.lyx.org/LyX/NewInLyX22). If you are interested you can test the latest development version, which has installers here: ftp.lyx.org/pub/lyx/devel/lyx-2.2/2.2.0-latest – scottkosty Mar 17 '16 at 4:29

LyX supports the concept of Character Styles one can select from the Text Style menu.

enter image description here

However, to be available, character styles have to be defined inside a .layout file or in the document-local Local Layout field available under Document Setting. (The Local Layout basically can be understood as the LyX-specific preamble of the document.)

Add the following to the Local Layout:

## Character Style to be used for whatever Fancisco intends :-)
Format 49
InsetLayout Flex:replace
  LyxType               charstyle
  LabelString           Replace 
  LatexType             command
  LatexName             replace
    Series              Bold
    Color               Red
    Series              Medium
    Color               Red
    Shape               Up
    Size                Tiny
    Family              Sans              
  ResetsFont true

Now you have a new character style Replace available in your document.

| improve this answer | |

LyX has its own notes (Insert>Note): the yellow note produces no output in compiled document, while the greyedout one produces, well, grayed-out text. If you don't like the color, change it by adding, say, \definecolor{note_fontcolor}{rgb}{0.9, 0.1, 0.1} to Document>Settings>preamble. LyX will also provide you with a list of such notes in the Navigate menu.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.