我创建了自己的环境,用于在文本中放置引号或一些重要内容。(它只是 tikz 中的一个 \node)但是,当我将节点的 \textwidth 设置为 \linewidth 并设置内部分隔符时,右边框超出了我的边距。当我使用较小的文本宽度(如 .9\linewidth)时,似乎没问题。较小的文本宽度也可以。我希望边框正好位于线宽处:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.geometric}
\usepackage{lipsum}
\NewEnviron{bquote}{%
\par%
\vspace{.5cm}
\noindent%
\centering
\begin{tikzpicture}[every node/.style={align=justify}]% %%Linewidth default bei 7pt
\node[text width=.7\linewidth,font=\normalsize, scale=1, draw=none,inner sep=20](q){\BODY};%
\draw[fill=red] (q.center) circle (1cm) node {OKAY};
\draw[semithick,line width=.4pt,overlay,black] ($(q.north west) + (15pt,0)$)--(q.north west)--(q.south west)-- ($(q.south west) + (15pt,0)$);%
\draw[semithick, line width=.4pt,overlay,black] ($(q.north east) - (15pt,0)$) --(q.north east) -- (q.south east)--($(q.south east)- (15pt,0)$) ;%
\end{tikzpicture}%
\par%
\vspace{.35cm}
}%
\title{ForumMWE}
\begin{document}
\maketitle
\section{Introduction}
\lipsum[4]
\begin{bquote}
\lipsum[4]
\end{bquote}
\noindent\lipsum[4]
\end{document}
其结果是:
改变这一点
\node[text width=.7\linewidth,font=\normalsize, scale=1, draw=none,inner sep=20](q){\BODY};%
对此
\node[text width=1\linewidth,font=\normalsize, scale=1, draw=none,inner sep=20](q){\BODY};%
导致:
答案1
您需要计算线宽以便删除括号的空间:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.geometric}
\usepackage{lipsum}
\NewEnviron{bquote}{%
\par
\addvspace{\topsep}
\centering
\begin{tikzpicture}[baseline,every node/.style={align=justify}]% %%Linewidth default bei 7pt
\node[
text width=\linewidth-40pt,
font=\normalsize,
scale=1,
draw=none,
inner sep=20
](q){\BODY};
\draw[fill=red] (q.center) circle (1cm) node {OKAY};
\draw[semithick,line width=.4pt,overlay,black]
($(q.north west) + (15pt,0)$)--(q.north west)--(q.south west)
-- ($(q.south west) + (15pt,0)$);
\draw[semithick, line width=.4pt,overlay,black]
($(q.north east) - (15pt,0)$) --(q.north east) -- (q.south east)
--($(q.south east)- (15pt,0)$) ;
\end{tikzpicture}%
\par
\addvspace{\topsep}
}
\title{ForumMWE}
\author{SRel}
\begin{document}
\maketitle
\section{Introduction}
\lipsum[4]
\begin{bquote}
\lipsum[4]
\end{bquote}
\noindent\lipsum[4]
\end{document}