![如何在没有框的情况下为乳胶中的文本添加阴影?](https://linux22.com/image/325198/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%B2%A1%E6%9C%89%E6%A1%86%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%E4%B8%BA%E4%B9%B3%E8%83%B6%E4%B8%AD%E7%9A%84%E6%96%87%E6%9C%AC%E6%B7%BB%E5%8A%A0%E9%98%B4%E5%BD%B1%EF%BC%9F.png)
我想在报告中为文本添加背景阴影。但我不想使用方框来包装文本。这可能吗?我的代码的 MWE 如下所示。在代码中,我想为描述列表添加阴影。
\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}
答案1
使用tcolorbox
,阴影背景并不是很困难,例如使用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}
答案2
最简单的方法可能是使用framed
包,它定义了一个shaded
(阴影溢出边距)和一个shaded*
(阴影适合边距)环境。这些环境可以跨页面。顺便说一句,您的一个描述文本会以默认布局流入边距。如果您不使用边距注释,您可以加载包geometry
,它会设置更合理的边距。或者,您可以加载enumitem
并使用nextline
描述样式。
\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}
答案3
这是一个选项。也许使用该enumitem
包可以做得更好。
\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}
答案4
\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}