我有一个用于放置小费的盒子,但我希望它周围有一个图案,就像示例图片中那样。
感谢您的帮助!
\documentclass[ngerman]{scrbook}
\usepackage{fontspec}
\usepackage{babel}
\usepackage{tabularx,colortbl,multirow,dcolumn}
\renewcommand\tabularxcolumn[1]{b{#1}}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{titletoc,titlesec,enumitem}
\newenvironment{Test}{
\begin{center}
\begin{sffamily}
\setlength\arrayrulewidth{0.75pt}\arrayrulecolor{white}
\renewcommand{\arraystretch}{1.3}
\begin{tabular}[h!]{p{\textwidth-2\tabcolsep}}
\rowcolor[gray]{0.6} \textbf{{\color{white}Testbox}} \\
\hline
\rowcolor[gray]{0.90} }
{\\
\end{tabular}
\end{sffamily}
\end{center}
}
\begin{document}
\begin{Test}
Content
\end{Test}
\end{document}
答案1
一个可能的解决方案tcolorbox
(它应该完成所有请求,请参阅代码中的注释):
\documentclass[ngerman]{scrbook}
\usepackage{babel}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{decorations.shapes,shapes.geometric,backgrounds}
\pgfdeclarelayer{foreground}
\pgfsetlayers{main,foreground}
\newtcolorbox{Test}[1][Testbox]{
title=Testbox,
colback=gray!20,
coltitle=white,
fonttitle=\bfseries\sffamily,
fontupper=\sffamily,
left=1pt, % left space between content text and box
lefttitle=1pt, % left space between
outer arc=0pt,
boxrule=0pt,
skin=freelance,
title engine=path,
title style={fill=gray!70,text=white},
frame code={
\begin{pgfonlayer}{foreground}
\draw[white,ultra thick]
(interior.north east)--(interior.north west); % white line between title and content
\draw[decorate,
decoration={shape backgrounds,
shape=diamond,
shape size=1.75mm, %
shape sep={2mm,between centers}}, % adjust the separation between diamonds
fill=white]
(frame.south west) rectangle (frame.north east);
\end{pgfonlayer}
},
}
\begin{document}
\begin{Test}
This is some content
\begin{center} % center part of the content
This is some content
\end{center}
This is some content
\end{Test}
\end{document}
结果:
我建议您参考软件包文档来了解有关软件包提供的各种选项的更多见解。
答案2
这可能是该包的工作niceframe
:
\documentclass{article}
\usepackage{niceframe}
% Defining some dummy text
\newcommand\dummytext{
\begin{minipage}{.85\textwidth}
{\bfseries\large Moral principles types:}
\begin{itemize}
\item Categoric Imperative (Inmmanuel Kant).
\item Do not worry about justice, but act and words to justify your action will come to you afterward ( Niccol\`o Machiavelli)
\item Those are my principles, and if you don't like them... well, I have others (Groucho Marx).
\end{itemize}
\end{minipage}
}
% A general nice frame (see "texdoc niceframe")
\newcommand{\marco}[1]{
\font\border=umrandb
\generalframe
{\border \char5} % up left
{\border \char1} % top
{\border \char4} % up rigth
{\border \char2} % izq
{\border \char0} % dcha
{\border \char6} % down left
{\border \char3} % bottom
{\border \char7} % down rigth
{#1}
}
\begin{document}
\marco{\dummytext}
\end{document}