![在 TikzEdt 中绘制外部边界框](https://linux22.com/image/456301/%E5%9C%A8%20TikzEdt%20%E4%B8%AD%E7%BB%98%E5%88%B6%E5%A4%96%E9%83%A8%E8%BE%B9%E7%95%8C%E6%A1%86.png)
我在使用 TikzEdt 软件时遇到了问题。Miktex 2.9 版运行一切正常。但是,当我将 Miktex 升级到 22 版时,TikzEdt 无法正常工作。以下代码会自动在 preview.tex 文件中生成。
\usetikzlibrary{calc}
\pgftransformreset
\node[inner sep=0pt,outer sep=0pt,minimum size=0pt,line width=0pt,text width=0pt,text height=0pt] at (current bounding box) {};
%add border to avoid cropping by pdflibnet
\foreach \border in {0.1}
\useasboundingbox (current bounding box.south west)+(-\border,-\border) rectangle (current bounding box.north east)+(\border,\border);
\newwrite\metadatafile
\immediate\openout\metadatafile=\jobname_BB.txt
\path
let
\p1=(current bounding box.south west),
\p2=(current bounding box.north east)
in
node[inner sep=0pt,outer sep=0pt,minimum size=0pt,line width=0pt,text width=0pt,text height=0pt,draw=white] at (current bounding box) {
\immediate\write\metadatafile{\p1,\p2}
};
\immediate\closeout\metadatafile
我发现上述代码使绘图超出了 TikzEdt 的边界框。它总是生成 A4 大小的 pdf,而不是适合绘图的 pdf。
这是 TikzEdt 中的序言:
\documentclass{article}
%\documentclass[[class=minimal,border=0pt]{standalone}
\usepackage{tikz}
%\usepackage{tikz,amsmath, amssymb,bm}
\usepackage[margin=0cm,nohead]{geometry}
\usepackage[active,tightpage]{preview}
\usetikzlibrary{shapes,arrows}
% needed for BB
%\usetikzlibrary{calc}
%\usepackage{standalone}
\usepackage{mathtools,amsmath,amssymb,amsfonts}
\usepackage[pdftex]{graphicx}
\usepackage{xcolor}
\usepackage{circuitikz} %draw circuit
\usepackage{pgfplotstable}%draw graph
\usepackage{pgfplots}%draw graph
\usepackage{tikz-3dplot} %draw 3d
\usepackage{filecontents}
\usepackage{float}
\pgfplotsset{compat=1.13}
\PreviewEnvironment{tikzpicture}
以及 preview.tex 文件中生成的代码
\begin{document}
\begin{tikzpicture}
\draw(-1,1) -- (4,0);
% \draw[draw=black] (7.5,3.5) rectangle ++(1,1);
\usetikzlibrary{calc}
\pgftransformreset
\node[inner sep=0pt,outer sep=0pt,minimum size=0pt,line width=0pt,text width=0pt,text height=0pt] at (current bounding box) {};
%add border to avoid cropping by pdflibnet
\foreach \border in {0.1}
\useasboundingbox (current bounding box.south west)+(-\border,-\border) rectangle (current bounding box.north east)+(\border,\border);
\newwrite\metadatafile
\immediate\openout\metadatafile=\jobname_BB.txt
\path
let
\p1=(current bounding box.south west),
\p2=(current bounding box.north east)
in
node[inner sep=0pt,outer sep=0pt,minimum size=0pt,line width=0pt,text width=0pt,text height=0pt,draw=white] at (current bounding box) {
\immediate\write\metadatafile{\p1,\p2}
};
\immediate\closeout\metadatafile
\end{tikzpicture}
\end{document}
cture}
\end{document}
我四处寻找解决方案,但没找到。请您帮我解决。提前谢谢您!