swiftswiftuilatex

How can I set background color of text with LaTeXSwiftUI?


I am using the LateXSwiftUI package. I want to set the background color of part of the text. However, using \colorbox does not seem to set the background to the desired color of red, resulting in a black box being put over "Hello." I have tried other colors, RGB colors, and hex colors, none of which have helped.

Code:

LaTeX("\\colorbox{red}{Hello}, World!")
.parsingMode(.all)

enter image description here


Solution

  • try this:

    LaTeX("\\colorbox{red}{Hello}, World!")
        .imageRenderingMode(.original)  // <--- here
        .parsingMode(.all)