我想减少 BC 边到边框底部之间的距离,我尝试过不设置边框,但 BC 边下方有空白。这是我的代码
\documentclass[12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tkz-euclide}
\usetkzobj{all}
%\tikzset{hidden/.style = {thin, dotted}}
\tikzset{hidden/.style = {thick, dashed}}
\tkzSetUpPoint[size = 10,fill = black]
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoints{0/0/A,
6/0/D,
-3/-3/B,
3/-3/C,
1/5/S,
1/-2/H}
\tkzDefLine[parallel=through H](A,D)
\tkzGetPoint{d}
\tkzDefLine[parallel=through H](A,B)
\tkzGetPoint{l}
\tkzInterLL(d,H)(A,B) \tkzGetPoint{M}
\tkzInterLL(d,H)(C,D) \tkzGetPoint{N}
\tkzInterLL(l,H)(C,B) \tkzGetPoint{P}
\tkzInterLL(l,H)(A,D) \tkzGetPoint{Q}
\tkzLabelPoints[above](S, Q)
\tkzLabelPoints[right](N,D)
\tkzLabelPoints[left](A)
\tkzLabelPoints[below](B,C,H,M,P)
\tkzDrawPoints(S,A,B,C,D,H,M,N,P,Q)
\tkzDrawSegments[hidden](S,A A,B A,D S,H M,N P,Q A,H B,H C,H D,H)
\tkzDrawPolygon[line width = 1.2pt](S,B,C)
\tkzDrawPolygon[line width = 1.2pt](S,C,D)
\tkzLabelSegment[below=2pt](B,P){$x$}
\tkzLabelSegment[below=2pt](C,P){$y$}
\tkzLabelSegment[right=4pt](C,N){$z$}
\tkzLabelSegment[right=4pt](D,N){$t$}
\end{tikzpicture}
\end{document}
我怎样才能减少这些空白?
答案1
您可以尽早修复边界框:
理想的位置是在坐标之后立即进行标记B
但在绘图的其余部分之前,但D
由于S
我不太熟悉,所以tkz-euclide
我只是使用给定的坐标并添加了一些填充。
实际情况是,部分绘图使用了未显示的点/路径,从而导致边界框变大。use as bounding box
设置的边界框不受任何其他绘图的影响。
代码:
\documentclass[12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tkz-euclide}
\usetkzobj{all}
%\tikzset{hidden/.style = {thin, dotted}}
\tikzset{hidden/.style = {thick, dashed}}
\tkzSetUpPoint[size = 10,fill = black]
\begin{document}
\begin{tikzpicture}[scale=1]
\tkzDefPoints{0/0/A,
6/0/D,
-3/-3/B,
3/-3/C,
1/5/S,
1/-2/H}
%% --------------------------------------------- Add padding around the points.
\coordinate (B') at ([shift={(-10pt, -20pt)}]B);
\coordinate (D') at ([shift={(20pt, 0)}]D);
\coordinate (S') at ([shift={(0pt, 15pt)}]S);
\draw [use as bounding box] (B') -| (D') |- (S') -| (B');% Fix the bounding box
%% ---------------------------------------------
\tkzDefLine[parallel=through H](A,D)
\tkzGetPoint{d}
\tkzDefLine[parallel=through H](A,B)
\tkzGetPoint{l}
\tkzInterLL(d,H)(A,B) \tkzGetPoint{M}
\tkzInterLL(d,H)(C,D) \tkzGetPoint{N}
\tkzInterLL(l,H)(C,B) \tkzGetPoint{P}
\tkzInterLL(l,H)(A,D) \tkzGetPoint{Q}
\tkzLabelPoints[above](S, Q)
\tkzLabelPoints[right](N,D)
\tkzLabelPoints[left](A)
\tkzLabelPoints[below](B,C,H,M,P)
\tkzDrawPoints(S,A,B,C,D,H,M,N,P,Q)
\tkzDrawSegments[hidden](S,A A,B A,D S,H M,N P,Q A,H B,H C,H D,H)
\tkzDrawPolygon[line width = 1.2pt](S,B,C)
\tkzDrawPolygon[line width = 1.2pt](S,C,D)
\tkzLabelSegment[below=2pt](B,P){$x$}
\tkzLabelSegment[below=2pt](C,P){$y$}
\tkzLabelSegment[right=4pt](C,N){$z$}
\tkzLabelSegment[right=4pt](D,N){$t$}
\end{tikzpicture}%
\end{document}