在输入中调整 tikzpicture 的大小

在输入中调整 tikzpicture 的大小

我试图将 tikspicture 插入到我的文本中。但是,我没有将代码放在实际文档中,而是将其作为输入,例如:

\begin{figure}[h]

\input{Grafikk/ValuesToOpinion}

\caption{Lorem Ipsum}
\label{Dolor Sit Amet}
\end{figure} 

如果我想更改图形中的某些内容,这样操作会变得容易得多,并使文档更加清晰。图片变得比我想要的要大一些,并且超出了页面。我似乎也找不到重新缩放它的方法。\input{}在内使用\includregraphics{}只会返回错误,因为它需要常规图片格式。我也尝试\tikzset{every picture/.style={line width=0.5pt}}在序言中使用,但没有任何变化。有人有什么提示吗?

MWE: 文档:

 \documentclass{report}
  \usepackage{graphicx}
  \usepackage{tikz}
   \usepackage{kantlipsum}

\begin{document}
 \kant[5]

 \begin{figure}[h]
 \input{tixzfigure}   
  \label{something}
  \caption{something else}  
   \end{figure}
   Dolor sit amet
  \end{document}

tikz-图形:

 \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
 

    %Shape: Triangle [id:dp09448679081661204] 
    \draw   (316.15,13) -- (635.3,161.2) -- (-3,161.2) -- cycle ;
    %Shape: Rectangle [id:dp80163133792419] 
     \draw   (-7.7,25) -- (655.3,25) -- (655.3,65) -- (-7.7,65) -- cycle ;
    \end{tikzpicture}

此外,所有 tikz 代码均来自此网站https://www.mathcha.io/editor

答案1

探讨了缩放主题之后,其他相当明显的适合大于文本区域的图形的选项是:

(1)使用横向模式,或

(2)利用边距。

对于 #2,我使用包xcoffins。材料(文本、图像、tikzfigures、表格等)放置在特殊框中,这些框可以以多种方式附加到其他类似框,包括添加 X 和 Y 偏移(通过(X offset, Y offset)命令应用Join)。

第二个功能允许将材料轻松地放置在物理页面的任何位置。

这些框表现得像文本对象,因此它们不是浮点数,并且在当前插入点排版。

相同的包装允许盒子旋转,如第二页所示。

x1

x2

\documentclass{report}
\usepackage{graphicx}
\usepackage{tikz}


\usepackage{caption}
\usepackage{xcoffins}

\NewCoffin\Framex
\NewCoffin\tikzFig

\usepackage{showframe}
\renewcommand*\ShowFrameColor{\color{red}}

\begin{document}
        
As any dedicated reader can clearly see, the Ideal of
practical reason is a representation of, as far as I know, the things
in themselves; as I have shown elsewhere, the phenomena should only be
used as a canon for our understanding.


\begin{figure}[h]
    \centering
    \input{qtikzfigure2}   
    \label{something}
    \caption{something else out of page}  
\end{figure}

Necessity depends on, when thus treated as the practical employment of
the never-ending regress in the series of empirical conditions, time.
Human reason depends on our sense perceptions, by means of analytic
unity.

\bigskip

\SetHorizontalCoffin\tikzFig{%
\input{qtikzfigure2}    
}   
        
\JoinCoffins*\Framex[l,t]\tikzFig[l,t](-60pt,0pt) % shift towards left margin
\noindent\TypesetCoffin\Framex
\vspace*{\CoffinTotalHeight\tikzFig}    
\captionof{figure}{Input from file and X offset added to center}

\bigskip
    
As is shown in the writings of Aristotle, the things
in themselves (and it remains a mystery why this is the case) are a
representation of time. Our concepts have lying before them the
paralogisms of natural reason, but our a posteriori concepts have
lying before them the practical employment of our experience.

\newpage

\SetHorizontalCoffin\Framex{}

\RotateCoffin\tikzFig{90}
\JoinCoffins*\Framex[l,b]\tikzFig[r,vc](\textwidth/2,0pt) % centering 
\noindent\TypesetCoffin\Framex
\vspace*{\CoffinTotalHeight\tikzFig}    
\captionof{figure}{Input from file and X offset added to center plus rotated}


\end{document}

所使用的文件qtikzfigure2.tex包含OP提供的tikzfigure,其中在左边距插入时有一个矩形和一个溢出文本区域的三角形(图1)。

相关内容