Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I did not find bold word in the manual. My tex is:

\documentclass{article}
\usepackage[framemethod=tikz]{mdframed}
\newtheorem{question}{Question}
\mdfdefinestyle{que}{
  linecolor=cyan,
  backgroundcolor=cyan!20,
}
\surroundwithmdframed[style=que]{question}
\begin{document}
\begin{question}
Lorem. % No bolding needed here so save space here, but need to fix the above
\end{question}
\end{document}

How can you have bold font in mdframed environment?

share|improve this question
    
So you want Lorem to be bold? –  Werner Feb 23 at 19:25
1  
If you want the whole environment body bold adding the option font=\bfseries to the style definition should do –  cgnieder Feb 23 at 19:27
    
@cgnieder: Sounds like the answer. –  Peter Grill Feb 23 at 19:28
2  
And perhaps you want to take a look at the \newmdtheoremenv command as described in Section 8 of the »mdframed« manual. –  Thorsten Donig Feb 23 at 19:38
2  
So you searched for "bold" in the manual, which returned no hits, and you instantly gave up? That's not reasonable... –  Jubobs Feb 23 at 21:56

1 Answer 1

up vote 6 down vote accepted

If I understand your question correctly, you want to have a kind of title for your questions and that title should be bold-faced, In this case, you can define a new theorem style and use the note field (the optional argument) to get the desired result:

\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}

\newtheoremstyle{mystyle}
  {\topsep}%
  {\topsep}%
  {\itshape}%
  {}%
  {\bfseries}%
  {.}%
  {.5em}%
  {\thmname{#1}~\thmnumber{#2}\thmnote{. \bfseries#3}}%
\theoremstyle{mystyle}
\newtheorem{question}{Question}
\mdfdefinestyle{que}{
  linecolor=cyan,
  backgroundcolor=cyan!20,
}
\surroundwithmdframed[style=que]{question}
\begin{document}
\begin{question}[Lorem]
Text
\end{question}
\begin{question}
Text
\end{question}
\end{document}

enter image description here

If, on the other side you want all the contents bold-faced, you have two options:

  1. If you are not using amsthm, simply add font=\bfseries to the mdframed specifications:

    \documentclass{article}
    \usepackage[framemethod=tikz]{mdframed}
    
    \newtheorem{question}{Question}
    \mdfdefinestyle{que}{
      linecolor=cyan,
      font=\bfseries,
      backgroundcolor=cyan!20,
    }
    \surroundwithmdframed[style=que]{question}
    \begin{document}
    \begin{question}
    Text
    \end{question}
    \end{document}
    
  2. If you are using amsthm, you'll need to add the specification to the theorem style:

    \documentclass{article}
    \usepackage{amsthm}
    \usepackage[framemethod=tikz]{mdframed}
    
    \newtheoremstyle{mystyle}
      {\topsep}%
      {\topsep}%
      {\bfseries\itshape}%
      {}%
      {\bfseries}%
      {.}%
      {.5em}%
      {}%
    \theoremstyle{mystyle}
    \newtheorem{question}{Question}
    \mdfdefinestyle{que}{
      linecolor=cyan,
      backgroundcolor=cyan!20,
    }
    \surroundwithmdframed[style=que]{question}
    \begin{document}
    \begin{question}
    Text
    \end{question}
    \end{document}
    

enter image description here

Notice that italics plus bold-face might not be the best choice.

share|improve this answer
    
Very thorough answer again - thank you! –  Masi Feb 23 at 22:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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