我的代码无法编辑出漂亮的效果。请帮忙:对齐 4 个微笑(垂直和水平)谢谢
\documentclass[a4paper,11pt]{article}
\usepackage[a4paper,left=2cm,right=2cm,top=1cm,bottom=1cm]{geometry}
\usepackage{amsmath,amssymb,scalerel}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}
\usepackage{lipsum}
%\usepackage[utf8]{english}
\usepackage[english]{babel}
\usepackage{MnSymbol,wasysym}
\usepackage{tikzsymbols}
\usepackage[format=plain,
labelfont={bf,it},
textfont=it]{caption}
%\usepackage{adjustbox}
\usepackage{bbding}
\usepackage{pifont}
\input{insbox}
\usepackage{enumitem}
\makeatletter
\tcbset{
myvbox/.style 2 args={%
enhanced,
colback=white,
colframe=blue!30!black,
left=8mm,
overlay={
\node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
\path[fill=tcbcol@frame] ([email protected] west)--([email protected] east)
to[out=90, in=270] ([yshift=5mm][email protected])--
([email protected]|-frame.north)
[rounded corners=\kvtcb@arc] -|
(frame.west) |- ([email protected])[sharp corners] -- cycle;
\node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
},
#1
}
}
\makeatother
\newtcolorbox{myvbox}[2][]{%
myhbox={#1}{#2}
}
\begin{document}
\thispagestyle{empty}
\noindent
\begin{tcbposter}
\posterbox[height=3cm,width =4.8cm, myvbox={colframe=blue!80!black}{Mood}]{column=1, row=2, xshift=4.2cm, yshift=-1.3cm}{
%\vspace*{0.2cm}
\\
\hspace*{0.2cm} \dLaughey[2.0] \hspace*{0.5cm} \dNeutrey[2.0] \hspace*{0.5cm} \\
\\
\dInnocey[2.0] \hspace*{0.5cm} \dWalley[2.0] \hspace*{0.5cm}
}
\end{tcbposter}
\end{document}
答案1
我删除了所有与我无关的包。因此,代码运行正常。tikzsymbols
与 savebox 一样,将这些符号放入 tikz 矩阵中是安全的。因此,我在图片中放置了这样一个矩阵。您可能想要尝试几个参数
at (1.4,-1)
确定矩阵的位置。如果增加1.4
,矩阵将向右移动。column sep=9pt
定义列之间的距离。row sep=3pt
设置行之间的距离。|[xshift=2mm]|
引入了 22 个条目的额外水平移位。
如果需要,这些参数应该允许您调整笑脸的位置。请注意,我没有乱动参数posterbox
。我不知道这些设置的来源和原因,但从您的问题中,我猜想您希望保留它们,并且无需更改它们即可放置笑脸。
以下是代码和结果。
\documentclass[a4paper,11pt]{article}
\usepackage[a4paper,left=2cm,right=2cm,top=1cm,bottom=1cm]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{tikzsymbols}
\usepackage{tikz}
\usetikzlibrary{matrix}
\makeatletter
\tcbset{
myvbox/.style 2 args={%
enhanced,
colback=white,
colframe=blue!30!black,
left=8mm,
overlay={
\node[rotate=90, anchor=north west, inner sep=2mm, text=white] (title@aux) at (frame.south west) {#2};
\path[fill=tcbcol@frame] ([email protected] west)--([email protected] east)
to[out=90, in=270] ([yshift=5mm][email protected])--
([email protected]|-frame.north)
[rounded corners=\kvtcb@arc] -|
(frame.west) |- ([email protected])[sharp corners] -- cycle;
\node[rotate=90, inner sep=2mm, text=white] at (title@aux) {#2};
},
#1
}
}
\makeatother
\newtcolorbox{myvbox}[2][]{%
myhbox={#1}{#2}
}
\begin{document}
\begin{tcbposter}
\posterbox[height=3cm,width =4.8cm, myvbox={colframe=blue!80!black}{Mood}]{%
column=1, row=2, xshift=4.2cm, yshift=-1.3cm}{
\begin{tikzpicture}
\path(0,0);
\matrix[ampersand replacement=\&,matrix of nodes,column sep=9pt,
row sep=3pt] at (1.4,-1) {
\dLaughey[2.0] \& \dNeutrey[2.0] \\
\dInnocey[2.0] \& |[xshift=2mm]| \dWalley[2.0] \\
};
\end{tikzpicture}
}
\end{tcbposter}
\end{document}