TeX - LaTeX Asked by Alex990MW on June 24, 2021
Please, what I need is an example environment that has a violet [rgb(238, 130, 238) for example] background, the font color black and this has to work on xelatex (I need this compiler because I’m working with Japanese texts and furigana that only works on xelatex)
Use this sentence on your example:
usepackage{mathptmx}
begin{document}
begin{example}
{fontsize{25}{30}selectfont 口} meaning mouth
Kun’yomi: くち
On’yomi: コウ、ク
end{example}
end{document}
you can e.g. use tcolorbox. It will works with xelatex too:
documentclass{article}
usepackage{tcolorbox}
definecolor{myviolett}{RGB}{238, 130, 238}
begin{document}
begin{tcolorbox}[colback=myviolett]
some text
end{tcolorbox}
end{document}
Correct answer by Ulrike Fischer on June 24, 2021
The following works in either LuaLaTeX or XeLaTeX:
documentclass{article}
tracinglostchars=2 % Warn if a character is missing
usepackage{iftex} % For ifluatex, ifxetex
usepackage[english]{babel}
usepackage{unicode-math} % For setmathfont
usepackage{xcolor, framed} % For shaded*
defaultfontfeatures{ Scale=MatchLowercase,
Ligatures=TeX }
babelfont{rm}
[Ligatures=Common,Scale=1.0,Language=Default]{TeX Gyre Termes} % Clone of Times.
babelfont{sf}
[Ligatures=Common,Language=Default]{TeX Gyre Heros} % Clone of Helvetica.
babelfont{tt}
[Language=Default]{Libertinus Mono}
setmathfont{TeX Gyre Termes Math}
ifluatex
babelprovide[import, onchar=ids fonts]{japanese}
else
babelprovide[import]{japanese}
usepackage{ucharclasses}
setTransitionsForJapanese%
{begin{otherlanguage}{japanese}}%
{end{otherlanguage}}
fi
babelfont[japanese]{rm}
[Renderer=HarfBuzz]{HaranoAjiMincho}
babelfont[japanese]{sf}
[Renderer=HarfBuzz]{HaranoAjiGothic}
% Define babelfont[japanese]{tt} here, if needed.
definecolor{shadecolor}{RGB}{238, 130, 238}
newenvironment{example}%
{begin{shaded*}}%
{end{shaded*}}
begin{document}
begin{example}
{huge 口} meaning mouth Kun'yomi: くち On'yomi: コウ、ク
end{example}
end{document}
Here, I used the framed
package, which should be able to deal with page breaks. Ulrike Fischer’s solution based on tcolorbox
will also work, and you can configure that package to do fancier things.
Answered by Davislor on June 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP