tikzpicture,太高的 tikzpicture 会产生第一个空白页,我该如何修复?

tikzpicture,太高的 tikzpicture 会产生第一个空白页,我该如何修复?

这是一个小问题,但我无法解决它。

以下代码应生成单页输出。由于 tikzpicture 太高,输出的第一个页面为空。我该如何修复它?(当我有较短的 B 字符串时,我会得到单页输出)

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{varwidth} % for Large braces
\usepackage{tikz}
\tikzset{
mynode/.style={fill,circle,inner sep=3pt,outer sep=0pt}
}

\usetikzlibrary{decorations.pathreplacing,intersections}
\usetikzlibrary{calc, arrows, decorations.markings, decorations.text, arrows.meta}

\usepackage{graphicx} 
\usepackage{pdflscape}

\begin{document}
\pagestyle{empty}
\begin{landscape}
    \hspace*{-3.3cm}
    \begin{tikzpicture}[every node/.append]
        \def\ra{13}
        \def\rii{-9}
        \coordinate (a) at (\rii,0);
        \coordinate (aa) at (\rii,5);
    \draw[black,thick, -latex] (a) -- (aa);  
    \draw[black,thick, -latex] 
    (a) -- (\ra,0) 
    node[pos=0.32,mynode,fill=blue,label={[label distance=0.2cm,text depth=2ex,rotate=75, align=left, font=\Large\linespread{0.8}\selectfont ]right: \textcolor{blue}{{\Large{\textbf{\today}:}}} \textcolor{blue}{{\Large{AAAAAAAAAA}}} \textcolor{blue}{{\Large{BBBBBB-BBB}}}  \\ \textcolor{blue}{{\Large{CCCCCCCCCC}}}  
}]{};  

\end{tikzpicture}
\end{landscape}
\end{document}

答案1

这是一个更通用的方法。

1)将 Tikz 绘图编译为单独的 .pdf

假设它被称为tikz.tex,编译为tikz.pdf;请识别不同的文档类:

\documentclass[10pt,border=3mm,tikz]{standalone}

\begin{document}
 \begin{tikzpicture}[
    every node/.append,
    mynode/.style={fill,circle,inner sep=3pt,outer sep=0pt}
    ]
        \def\ra{13}
        \def\rii{-9}
        \coordinate (a) at (\rii,0);
        \coordinate (aa) at (\rii,5);
    \draw[black,thick, -latex] (a) -- (aa);  
    \draw[black,thick, -latex] 
    (a) -- (\ra,0) 
    node[pos=0.32,mynode,fill=blue,label={[label distance=0.2cm,text depth=2ex,rotate=75, align=left, font=\Large\linespread{0.8}\selectfont ]right: \textcolor{blue}{{\Large{\textbf{\today}:}}} \textcolor{blue}{{\Large{AAAAAAAAAA}}} \textcolor{blue}{{\Large{BBBBBB-BBB}}}  \\ \textcolor{blue}{{\Large{CCCCCCCCCC}}}  
}]{};  

 \end{tikzpicture}
\end{document}

绘画

2)将此 .pdf 添加到您的主文件中

归结为相关部分,只需根据需要设置比例或宽度:

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{varwidth} % for Large braces

% ~~~ not needed here ~~~~~~~~~~~~~~~~
%\usepackage{tikz}
%\tikzset{
%mynode/.style={fill,circle,inner sep=3pt,outer sep=0pt}
%}
%
%\usetikzlibrary{decorations.pathreplacing,intersections}
%\usetikzlibrary{calc, arrows, decorations.markings, decorations.text, arrows.meta}

\usepackage{graphicx} 
\usepackage{pdflscape}

\begin{document}
\pagestyle{empty}
\begin{landscape}
    \hspace*{-3.3cm}
    \includegraphics[scale=1]{tikz}
\end{landscape}
\end{document}

结果

相关内容