1

I prepare a document in Markdown in which I have to highlight changes in color. I am aware that I could wrap the text like this:

This text is unchanged, however \textcolor{red}{I changed this}, before going back to the original color. 

But I would prefer to define my own command, similar to the **<this is bold text>** solution, without all the brackets. I found the following solution to make all bold text also blue, but since I am new to latex I have been unsuccessful trying to adapt this. I found out how to change the textcolor after a custom command for the rest of the document by including this at the beginning of my Markdown document:

\newcommand{\x}{\color{red}}

Like this, the text color switches to red after I write \x somewhere in the text. The next step would be along these lines:

\newcommand{\x}{%
             \ifthenelse{\equal{\color}{black}}% if the text color is currently black
              {\color{red}}% set it to red
              {\color{black}% else set it back to black}}

I want this custom command to check the current text color. Like this, I could ideally have some unchanged text and \x wrap the changed section in the custom command, making this red \x, before going back to the original color. Does anyone have an idea how I could write this in Latex? Any help appreciated!

lilla
  • 151
  • 3
  • 12

1 Answers1

1

Using a similar approach as in https://stackoverflow.com/a/52390056 , you could change the behaviour of **...** to give red text instead of bold:

\renewcommand\textbf[1]{\textcolor{red}{#1}}