0

My team wants to highlight a certain word by using a yellow background, as a reminder that this value needs to be edited manually.

Desired result:

enter image description here

I try to make this happen (inspired by this answer). I format a line of text in my reference text as Times New roman with font size 12, with bold text and a yellow background. I then save the format as a "character"-type style and I save it under "boldyellow" in order to avoid underscores.

In my r markdown document I write:

<span custom-style=“boldyellow”>SKRIV IN ANTAL</span> av **21** regioner moretext moretext.

With no obvious result:

enter image description here

Am I missing one or more steps I haven't tought of? Is this possible at all using this method?

Magnus
  • 728
  • 4
  • 17
  • Hm. Should work. Check you quotes around "boldyellow". When I copied and pasted your example code into an Rmd it did not work because of `“` instead of `"`. After fixing that it worked fine. – stefan Aug 10 '21 at 11:53
  • ... instead of `SKRIV IN ANTAL` you could also do `[SKRIV IN ANTAL]{custom-style="boldyellow"}` – stefan Aug 10 '21 at 11:55
  • Thanks for pointing out the smart quotes. Strangely none of these methods work for me. It's not only the yellow backgorund, the Rmd file seems to refuse to work wih any span tags "at all". Do I need to perfom some steps in order to allow this functionality in the first place? – Magnus Aug 10 '21 at 12:02
  • I also tried just changing the font color to red, which refused to work. I tried to check if it read the latest version of the style reference document, which it did :/ – Magnus Aug 10 '21 at 12:10
  • Hm. As far as I get it you did everything right. I did the same. Except that I started from a fresh default docx. Added the style as a character style. Included it via the YAML as reference_docx. And worked fine. ): – stefan Aug 10 '21 at 12:12
  • Wait a minute, I just managed to get it to work with red font color. The key was to base the style on "Default Paragraph Text.". But how did you manage to get a yellow background for the style? I saw no option for that in the menu.... – Magnus Aug 10 '21 at 13:38
  • 1
    You could set the background color via Borders -> Shadings -> Fill color. – stefan Aug 10 '21 at 13:54
  • 1
    Okay, problem solved, thanks for input! – Magnus Aug 10 '21 at 13:56

0 Answers0