keep colored text from .docx to .tex using pandoc

I use pandoc on a Mac to translate a .docx document to a .tex document. The problem is that some words in the .docx document are colored (not highlighted but colored letters) and pandoc doesn't recognize the color so in the .tex document all words appear black. I want it to automatically load the color package and translate a colored text into something like:

asdf \textcolor{red}{asdfasdf} asdfasdf.


In the end I want to find&replace the \textcolor commands e.g. by a custom cite-environment. If you have another idea to find&replace colored text in a Word document I will be satisfied as well. thanks

• Export to LateX from Libreoffice can produce code as \textcolor[rgb]{1.0,0.2,0.2}{text} selecting the right options of the export window. However, at the end of day I will opt for pandoc or export as "very simple article" (without colors) in Libreoffice. – Fran Jan 21 '18 at 22:12
• do you have an other idea to mark something in the docx-document to replace it later automaticly? I thought of marking text in bold face or underlined but these are only two possible environments. So an additional idea was to play with the fontsize, but this will be annoying to look at in the docx-document – John Jan 21 '18 at 22:24
• Use some custom markup and then use sed (or similar) to convert the text yourself. (This may make the .docx source less reader-friendly, but no more so than some people find (say) *TeX or markdown sources.) – jon Jan 22 '18 at 6:14
• If you do not use cursive-italics often, also text in .docx-.odt documents can be also exported as \emph{text} (pandoc,abiword) or \textit{text} (libreoffice) that later could be replaced easily by \cite{text} or something else. – Fran Jan 22 '18 at 7:00
• But guessing about the real problem (write/read without being disturbed too much by LaTeX code?) I would suggest write in markdown so you can write *text* or directly \emph{text} to obtain \emph{text} in LaTeX, or mark with something else LaTeX command that will be exported to LaTeX as is (e.g. \xxxx{text} is exported just as \xxxx{text} but of course, in this case in the markdown text you should also define what \xxxx does, just like in a LaTeX document). – Fran Jan 22 '18 at 7:33