最后,我成功地创建了属于自己的引用风格:
\usepackage[most]{tcolorbox}
\definecolor{block-gray}{gray}{0.95}
\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
\hbox{}\nobreak\hfil(#1)%
\parfillskip=0pt \finalhyphendemerits=0 \endgraf}}
\newtcolorbox{zitat}{
colback=block-gray,
grow to right by=-10mm,
grow to left by=-10mm,
boxrule=0pt,
boxsep=0pt,
breakable
}
\newsavebox\mybox
\newenvironment{aquote}[1]
{\savebox\mybox{#1}\begin{zitat}}
{\signed{\usebox\mybox}\end{zitat}}
但我期待使用一种新样式。我喜欢使用一种引文样式,在左侧有一个灰色条,并且引文区域应为有角度的形状。该区域也应包括来源,就像我上面的方法一样。
你们有人有办法吗?谢谢你的帮助。
答案1
我使用了原始zitat
tcolorbox
环境并对其进行了一点扩展,将标题分离到上方的框中,并使用粗体字体,并\large
作为字体大小声明。
可以使用选项生成垂直线borderline west=...
,盒子是可破坏的,如屏幕截图所示。
\documentclass{article}
\usepackage{blindtext}
\usepackage[most]{tcolorbox}
\definecolor{block-gray}{gray}{0.95}
\newtcolorbox{zitat}[2][]{%
colback=block-gray,
grow to right by=-10mm,
grow to left by=-10mm,
boxrule=0pt,
boxsep=0pt,
breakable,
enhanced jigsaw,
borderline west={4pt}{0pt}{gray},
title={#2\par},
colbacktitle={block-gray},
coltitle={black},
fonttitle={\large\bfseries},
attach title to upper={},
#1,
}
\begin{document}
\begin{zitat}{Minimal working document}
A document that contains the relevant documentclass, the packages, a document-environment and the code that produces the issue.
\blindtext[5]
\end{zitat}
\end{document}
答案2
我以前用 TikZ 实现过这样的盒子,这里是所使用的代码(设计不是很好)。
\documentclass[a4paper, 11pt]{article}
%% Global libraries
\usepackage[textwidth=18cm,bottom=2cm,top=2cm]{geometry}
%% Libraries for graphics and colours
\usepackage{xcolor}
\usepackage{tikz}
\usepackage[skins]{tcolorbox}
\definecolor{mygray}{RGB}{195,195,195}
\newcommand\todoFrame[2]{\vspace{.3cm}\noindent\tikz{
\node (contentnode) [draw, color = #1!25, fill=#1!15, text=black, rectangle, outer sep = 0, rounded corners = 1mm, minimum width=\linewidth-1, text width=\linewidth, align=justify, below right] at (0,0) {\noindent #2};
\draw[fill opacity = 1, color=#1, fill=#1] (0,0) rectangle ([xshift=5]contentnode.south west);}
\par}
\newcommand\todoEnv[3]{\par\todoFrame{#1}{\noindent\hspace*{.3cm}\textbf{\textcolor{#1}{\Large{#2}}}\vspace*{.2cm}\newline\noindent\hspace*{.3cm}\begin{minipage}{\dimexpr\linewidth-.3cm\relax}#3\end{minipage}}\ignorespaces}
\begin{document}
\todoEnv{mygray}{Fragment}{A \textbf{fragment} is a piece of an activity whice enable more modular activity design. It will not be wrong if we say, a fragment is a kind of \textbf{sub-activity}.}
\end{document}
请注意,此解决方案不会在分页符处中断......
但是,正如评论中所建议的那样,tcolorbox
在这里似乎更合适(如果有人想提交回复,请随意这样做!)。
无论如何,我希望它能对你有所帮助。