3

I would like to add a background shade to my text in a report. I do not want to use a box to wrap the text though. Is this possible? MWE of my code is given below. In the code, I would like to shade the description list.

\documentclass[11pt]{report}
\begin{document}

This document contains the author's responses to the comments from Examiner 2 and Examiner 3.\\\\ 
\Large{\underline{Response Categories}}
\begin{description}
  \item[A (Accept)] Denotes that the author accepts the comments in their entirety.
  \item[AM (Accept with Modifications to Original Context)] Denotes that the author accepts the comments in their entirety, and changes to the thesis would involve modification to the original context in which the relevant subject matter had been placed.
  \item[P (Partially Accept)] Denotes that the author accepts certain aspects of the comments while explicating reservations on the rest.
  \item[R (Reject)] Denotes that the author does not accept the comments.
  \item[RM (Reject with Suitable Modifications to Text)] Denotes that author does not accept the broader implication of the comment, but the text has been modified to address individual points raised as part of the comment, as applicable.
\end{description}
9
  • 3
    for (la)TeX almost every thing is a box.
    – touhami
    Dec 24, 2015 at 8:12
  • @touhami: I think the O.P. referred to something like \colorbox or mdframed etc, not the real \box register, but I may be wrong, of course.
    – user31729
    Dec 24, 2015 at 9:09
  • What do you want to shade exactly, in this code?
    – Bernard
    Dec 24, 2015 at 9:15
  • 1
    That's your second question with some missing code. In the other the \begin{description} was lost, here the \end{document}. Beside this: I would use tcolorbox. Dec 24, 2015 at 10:17
  • 1
    Well, it is not inserted in a box, it's inserted in an environment (of course there is ultimately a box behind the scene, but all TeX is about boxes). I don't understand your objection.
    – Bernard
    Dec 24, 2015 at 12:42

4 Answers 4

4

Using tcolorbox, shaded background is not really difficult, for example using interior style={top color=red,bottom color=yellow}.

\documentclass[11pt]{report}
\usepackage[lmargin=1.5cm,rmargin=2cm]{geometry}
\usepackage[most]{tcolorbox}
\begin{document}

This document contains the author's responses to the comments from Examiner 2 and Examiner 3.\\\\ 
\Large{\underline{Response Categories}}
\begin{tcolorbox}[width=\textwidth,enhanced,interior style={top color={red},bottom color={yellow}}]
  \begin{description}
  \item[A (Accept)] Denotes that the author accepts the comments in their entirety.
  \item[AM (Accept with Modifications to Original Context)] Denotes that the author accepts the comments in their entirety, and changes to the thesis would involve modification to the original context in which the relevant subject matter had been placed.
  \item[P (Partially Accept)] Denotes that the author accepts certain aspects of the comments while explicating reservations on the rest.
  \item[R (Reject)] Denotes that the author does not accept the comments.
  \item[RM (Reject with Suitable Modifications to Text)] Denotes that author does not accept the broader implication of the comment, but the text has been modified to address individual points raised as part of the comment, as applicable.
  \end{description}
\end{tcolorbox}
\end{document}

enter image description here

2

The simplest is perhaps to use the framed package, which defines a shaded(the shade overflows the margins) and a shaded*(the shade fits the margins) environments. These environments can break across pages. B.t.w., one of your description texts flows into the margin with the default layout. If you don't use margin notes, you can load the geometry package, which sets more sensible margins. Alternatively, you can load enumitem and use the nextline description style.

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[x11names]{xcolor}
\colorlet{shadecolor}{LavenderBlush3}
\usepackage{framed}
\usepackage{enumitem}
\usepackage[showframe]{geometry}

\begin{document}

This document contains the author's responses to the comments from Examiner 2 and Examiner 3.\\\\
\Large{\underline{Response Categories}}
\begin{shaded}
\begin{description}[style=nextline]
  \item[A (Accept)] Denotes that the author accepts the comments in their entirety.
  \item[AM (Accept with Modifications to Original Context)] Denotes that the author accepts the comments in their entirety, and changes to the thesis would involve modification to the original context in which the relevant subject matter had been placed.
  \item[P (Partially Accept)] Denotes that the author accepts certain aspects of the comments while explicating reservations on the rest.
  \item[R (Reject)] Denotes that the author does not accept the comments.
  \item[RM (Reject with Suitable Modifications to Text)] Denotes that author does not accept the broader implication of the comment, but the text has been modified to address individual points raised as part of the comment, as applicable.
\end{description}
\end{shaded}
%%%%%%%%%%%%%%%%%
\colorlet{shadecolor}{Thistle3!50}
\begin{shaded*}
\begin{description}
  \item[A (Accept)] Denotes that the author accepts the comments in their entirety.
  \item[AM (Accept with Modifications to Original Context)] Denotes that the author accepts the comments in their entirety, and changes to the thesis would involve modification to the original context in which the relevant subject matter had been placed.
  \item[P (Partially Accept)] Denotes that the author accepts certain aspects of the comments while explicating reservations on the rest.
  \item[R (Reject)] Denotes that the author does not accept the comments.
  \item[RM (Reject with Suitable Modifications to Text)] Denotes that author does not accept the broader implication of the comment, but the text has been modified to address individual points raised as part of the comment, as applicable.
\end{description}
\end{shaded*}
\end{document} 

enter image description here

1

Here is an option. May be one can do better using the enumitem package.

\documentclass{article}
\usepackage{color,soul}

\definecolor{lightblue}{rgb}{.8,.95,1}
\definecolor{LightBlue}{rgb}{.8,.9,1}
\sethlcolor{lightblue}

\renewcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries
                                \sethlcolor{LightBlue}\hl{#1}}

   % to be automatic                             
\newcommand{\bgitem}[2]{\item[#1]\hl{#2}}

\begin{document}


\begin{description}
  \item[A (Accept)]\hl{Denotes that the author accepts the comments in their entirety.}
  \item[AM (Accept with Modifications to Original Context)]\hl{Denotes that the author accepts the comments in their entirety, and changes to the thesis would involve modification to the original context in which the relevant subject matter had been placed.}
  \item[P (Partially Accept)]\hl{Denotes that the author accepts certain aspects of the comments while explicating reservations on the rest.}
  % here with \bgitem
  \bgitem{R (Reject)}{Denotes that the author does not accept the comments.}
\end{description}

\end{document}

It is better if one define a newenvironment hldescription and make the change to label local. enter image description here

1
\documentclass[11pt]{report}
\usepackage{xcolor}
\begin{document}

This document contains the author's responses to the comments from Examiner 2 and 
Examiner 3.

\bigskip\noindent
{\Large\underline{Response Categories}\par}\smallskip
\noindent
\colorbox{blue!40!white!80}{\parbox{\linewidth}{%
    \begin{description}
        \item[A (Accept)] Denotes that the author accepts the comments in their entirety.
        \item[AM (Accept with Modifications to Original Context)] Denotes that the author 
        accepts the comments in their entirety, and changes to the thesis would involve 
        modification to the original context in which the relevant subject matter had 
        been placed.
        \item[P (Partially Accept)] Denotes that the author accepts certain aspects of 
        the comments while explicating reservations on the rest.
        \item[R (Reject)] Denotes that the author does not accept the comments.
        \item[RM (Reject with Suitable Modifications to Text)] Denotes that author does 
        not accept the broader implication of the comment, but the text has been modified 
        to address individual points raised as part of the comment, as applicable.
    \end{description}%
}}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .