0

I am generating a report that spans multiple pages, and I'm using the mdframed package to display some data inside a box. I would like all the text inside the mdframed to appear in bold. Simply wrapping the section in \textbf{} isn't working. Here is an example:

\documentclass[8pt]{extarticle}

\usepackage{mdframed}

\global\mdfdefinestyle{default}{%
  usetwoside=false,%
  linecolor=black,linewidth=1pt,%
  innerleftmargin=10pt,innerrightmargin=0,%
  leftmargin=-120pt,rightmargin=-120pt,%
  everyline=true
}

\begin{document}
\begin{mdframed}[style=default]
\begin{verbatim}
\textbf{

ABC DEF GHI JKL MNO PQR STU WXY Z
123 456 789 123 456 789 123 456 7

}
\end{verbatim}
\end{mdframed}
\end{document}

which results in: enter image description here

Putting the \textbf{} outside the \begin{verbatim} results in an error. What am I doing wrong?

Also, as you can see, the text only occupies a very small fraction of the table. Is there a way to widen the text so that it occupies a bigger part of the table? It doesn't need to occupy the full table, but atleast half would be nice. To be clear, I'm not asking how to align in to the center, or make the table smaller, I would specifically like to widen the text. Thanks for the help.

Edit: I found this question, and it suggested I add font=\bfseries to \mdfdefinestyle, but I tried it and it didn't make a difference. It still looks the same. enter image description here

  • @Bernard, I tried it and it didn't work. A quick google search led me to this, and none of the methods suggested there work. The text still looks the same. Am I doing something wrong? – ytk Jul 27 '16 at 14:45
  • This is an age old problem: tex.stackexchange.com/questions/215482/… – Morten Høgholm Jul 27 '16 at 15:31
1

Use the Verbatim environment, from fancyvrb, and the optional argument of the environment. As there's very little difference bthe default to inconsolata to show it works:

\documentclass[8pt]{extarticle}
\usepackage{mdframed}
\global\mdfdefinestyle{default}{%
  usetwoside=false,%
  linecolor=black,linewidth=1pt,%
  innerleftmargin=10pt,innerrightmargin=0,%
  leftmargin=-120pt,rightmargin=-120pt,%
  everyline=true
}
\usepackage{zi4}
\usepackage{fancyvrb}

\begin{document}
\begin{mdframed}[style=default]
\bfseries
\begin{Verbatim}[fontseries = b]
ABC DEF GHI JKL MNO PQR STU WXY Z
123 456 789 123 456 789 123 456 7
\end{Verbatim}
\end{mdframed}

\begin{verbatim}
ABC DEF GHI JKL MNO PQR STU WXY Z
123 456 789 123 456 789 123 456 7
\end{verbatim}

\end{document} 

enter image description here

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.