3

I have written a a few latex lines to mimic the shaded boxes shown in the below picture: enter image description here

However, my result so far looks like the following: enter image description here

which doesn't look completely like the above image.

My lines are as follows:

\definecolor{bright_blue}{RGB}{31,127,198}
\definecolor{dark_red}{RGB}{176,31,31}

\definecolor{shadecolor}{RGB}{246,243,226}
\begin{shaded*}

\textcolor{dark_red}{\textbf{SUMMARY: }}
     
    Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
    , some text, some text, some text, some text.
    , some text, some text, some text, some text.
    , some text, some text, some text, some text, some text.
    
    \definecolor{shadecolor}{RGB}{239,244,243}
    \begin{shaded*}
        \textcolor{bright_blue}{\textbf{RESULTS: }}
        
        Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
        , some text, some text, some text, some text.
        , some text, some text, some text, some text.
        , some text, some text, some text, some text, some text.
    \end{shaded*}
\end{shaded*}

Does anyone know how I can make it more similar to the first image? In addition,how can I add the current chapter number like the above image.

2 Answers 2

4

I'm assuming this "shaded*" environment comes from framed.sty.

Best not to put one inside the other, but instead one after the other. Then the question becomes: how to prevent a gap between the two shaded environments.

The "extra" space can be eliminated by setting \OuterFrameSep, which is a parameter for framed.sty.

The remaining gap can be removed by suppressing the baseline skip. For this use a TeX command \nointerlineskip (which may not be officially LaTeX-ese).

\definecolor{shadecolor}{RGB}{246,243,226}
\setlength\OuterFrameSep{0pt}
\begin{shaded*}

\textcolor{dark_red}{\textbf{SUMMARY: }}
     
    Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
    , some text, some text, some text, some text.
    , some text, some text, some text, some text.
    , some text, some text, some text, some text, some text.
\end{shaded*}
\nointerlineskip  
\definecolor{shadecolor}{RGB}{239,244,243}
\begin{shaded*}
    \textcolor{bright_blue}{\textbf{RESULTS: }}
        
    Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
        , some text, some text, some text, some text.
        , some text, some text, some text, some text.
        , some text, some text, some text, some text, some text.
\end{shaded*}

Oh, the remaining difference in appearance is due to\parindent and \parskip (you should choose a style consistently throughout the document).

0
3

A small improvement, manually adjusting the vertical spacing between the two shaded environments to make the blank space completely disappear.

For the problem of the chapter number,n you have the \oldstylenums command.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{framed}
\usepackage{xcolor}
\definecolor{bright_blue}{RGB}{31,127,198}
\definecolor{dark_red}{RGB}{176,31,31}

\begin{document}

\definecolor{shadecolor}{RGB}{246,243,226}
\begin{shaded*}

\textcolor{dark_red}{\textbf{SUMMARY: }}

    Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
    , some text, some text, some text, some text.
    , some text, some text, some text, some text.
    , some text, some text, some text, some text, some text.
\end{shaded*}\vspace*{-\dimexpr\FrameSep + \baselineskip +1pt}
\definecolor{shadecolor}{RGB}{239,244,243}
\begin{shaded*}
    \textcolor{bright_blue}{\textbf{RESULTS: }}

    Some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text, some text
    , some text, some text, some text, some text.
    , some text, some text, some text, some text.
    , some text, some text, some text, some text, some text.
\end{shaded*}

\end{document} 

enter image description here

4
  • Improvement by changing automatic to manual adjustment? Oct 4, 2020 at 19:42
  • @DonaldArseneau: For me, \nointerlineskip results in a blank line. I found no other way to remove it. I tried top play with lengths defined in your package, but there remained a thin white line. Maybe there's a trick, but I didn't find it.
    – Bernard
    Oct 4, 2020 at 19:57
  • That is weird. I'd be interested in your test and log file, because I don't see how it could happen. Oct 5, 2020 at 7:48
  • @DonaldArseneau: Certainly. Can I mail them somewhere?
    – Bernard
    Oct 5, 2020 at 9:33

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.