3

Is there a way to specify different fonts for both typing and math mode in the tcolorbox environment. I want to use the default Computer Modern for most of my document, but use Concrete Fonts and Concrete math to define a theorem in the tcolorbox environment.

3
  • \fontfamily{}\selectfont is what you need, I think.
    – user156344
    Feb 16 '19 at 7:08
  • How is the font setup outside the box? Feb 16 '19 at 7:13
  • Welcome to TeX.StackExchange. We would love to get something of what you tried to get somewhere near your solution. So, posting a Minimal Working Example will be highly appreciated in your post.
    – Partha D.
    Feb 16 '19 at 13:22
5

The manual for tcolorbox has a mention for three variables to set the fonts in the title, upper and lower parts of the box.

So, one may use the code:

\documentclass{article} 
\usepackage{tcolorbox}
\newcommand{\fon}[1]{\fontfamily{#1}\selectfont}  %% Courtesy: @JouleV
\begin{document}
Normal text using default (Computer Modern Roman) font\ldots\medskip

%
\begin{tcolorbox}[fonttitle=\fon{pbk}\bfseries,
                  fontupper=\fon{ppl}\itshape,
                  fontlower=\fon{put}\scshape,
                  title=Tcolorbox using Bookman font in bold]
Upper part with Palatino font in italics.
\tcblower
Lower part with Utopia font in smallcaps.
\end{tcolorbox}
%
\end{document}

to get something like:

enter image description here

I'm not sure of how to bring in the Concrete font, as it being a Type-I font, requires different implementation.

2
  • You can get Concrete font by font code ccr. However, this doesn't change the math font.
    – user156344
    Feb 16 '19 at 13:25
  • @JouleV But I think it also requires some package like concrete, beton or ccfonts \usepackage[T1]{fontenc} as listed here. Maybe the code should also be compiled in LuaLaTeX or XeTeX to have the Concrete font take effect... however I tried several of these options-- to no avail. It would be great if you could post a solution !
    – Partha D.
    Feb 16 '19 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.