我尝试删除文本框之间的垂直空间。但是,由于我每次都使用newcommand打开一个新的tikzpicture,我觉得我不能使用setpace? 还有其他想法吗?
\documentclass[10pt,a5paper]{article}
\usepackage[left=10mm, right=10mm, bottom=15mm, top=10mm, footskip=5mm]{geometry}
\usepackage{xcolor}
\xdefinecolor{links}{RGB}{251,212,180}
\xdefinecolor{rechts}{RGB}{214,227,188}
\xdefinecolor{mitte}{RGB}{218,216,215}
\usepackage{tikz}
\usepackage{varwidth}
\usetikzlibrary{shapes}
\tikzstyle{sms} = [rectangle callout, draw,very thick, rounded corners, minimum height=20pt]
\newcommand{\smsr}[1]{\begin{flushright}
\begin{tikzpicture}
\node [sms, align=right,callout relative pointer={(0.5,0)}, fill=rechts] {\begin{varwidth}{0.7\textwidth}{#1}\end{varwidth}};
\end{tikzpicture}\end{flushright}}
\newcommand{\smsl}[1]{\begin{flushleft}
\begin{tikzpicture}
\node[sms, align=left,callout relative pointer={(-0.5,0)}, fill=links] {\begin{varwidth}{0.7\textwidth}{#1}\end{varwidth}};
\end{tikzpicture}\end{flushleft} }
\newcommand{\datum}[1]{\begin{center} \begin{tikzpicture}
\node[rectangle, very thick, text width=0.4\textwidth, rounded corners, draw,align=center, fill=mitte] {#1};
\end{tikzpicture} \end{center}}
\begin{document}
\small
\datum{Saturday, 22.July}
\smsl{Send Hallo}
\smsr{Answer Bye. Very long line to show the function of automatic line-breaking.}
\smsr{Still awake?}
\end{document}
答案 0 :(得分:2)
将每个tikzpicture
插入另一个环境中可能会插入不需要的垂直间距。也许不要使用它们:
\documentclass[10pt,a5paper]{article}
\usepackage[left=10mm, right=10mm, bottom=15mm, top=10mm, footskip=5mm]{geometry}
\usepackage{xcolor}
\xdefinecolor{links}{RGB}{251,212,180}
\xdefinecolor{rechts}{RGB}{214,227,188}
\xdefinecolor{mitte}{RGB}{218,216,215}
\usepackage{tikz}
\usepackage{varwidth}
\usetikzlibrary{shapes}
\tikzstyle{sms} = [rectangle callout, draw,very thick, rounded corners, minimum height=20pt]
\newcommand{\smsr}[1]{\hfill
\begin{tikzpicture}
\node [sms, align=right,callout relative pointer={(0.5,0)}, fill=rechts] {\begin{varwidth}{0.7\textwidth}{#1}\end{varwidth}};
\end{tikzpicture}
\par}
\newcommand{\smsl}[1]{%
\begin{tikzpicture}
\node[sms, align=left,callout relative pointer={(-0.5,0)}, fill=links] {\begin{varwidth}{0.7\textwidth}{#1}\end{varwidth}};
\end{tikzpicture}
\par}
\newcommand{\datum}[1]{%
\begin{center}
\begin{tikzpicture}
\node[rectangle, very thick, text width=0.4\textwidth, rounded corners, draw,align=center, fill=mitte] {#1};
\end{tikzpicture}
\end{center}}
\setlength{\parindent}{0pt}
\begin{document}
\small
\datum{Saturday, 22 July}
\smsl{Send Hallo}
\smsr{Answer Bye. Very long line to show the function of automatic line-breaking.}
\smsr{Still awake?}
\end{document}
我还删除了任何段落缩进,但保留了以下文本气泡之间的距离(使用center
)。
上述内容的替代方案,如果您打算使用\smsl
,\smsr
和\datum
所有内容,则可以使用\raggedright
,\raggedleft
和\centering
分别为({1}}而不是\hfill
而\smsl
为center
。