1

I am trying to insert an implemented tikz graphics into another latex document. I defined the tikz graphics in a standalone document. I defined a \tikzset inorder to draw cross nodes. This graphics works as it should, when I compile it alone, meaning the crosses are recognizes. When I insert the graphic into the other latex document using input, the graphics can be compiled but the crosses are not recognized and so they are ignored in the document.

\input{}

The standalone document of my graphic looks as follows:

\documentclass[tikz, border=2mm]{standalone}
\usetikzlibrary{shapes.misc}
\usepackage{tkz-euclide}

\tikzset{cross/.style={cross out, draw=black, minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt},
%default radius will be 1pt. 
cross/.default={1pt}}

\begin{document}
\begin{tikzpicture}%[scale = 0.4, every node/.style={scale=0.7}]
\tkzInit[xmax=12,ymax=12,xmin=-3,ymin=-3]
\tkzGrid
\tkzAxeXY
\coordinate (p1) at (0,0);
\coordinate (p2) at (6.6,5);
\coordinate (p3) at (5,7) ;
\draw  (0,0)node[cross = 4pt, thick, red, rotate = 90, label = {[black] above right :  \huge BS}](BS) {};
\draw  (6.6,5) node[cross = 4pt, thick, red, rotate = 90, label = {[black] below :  \huge UE}](UE) {};
\draw [shorten >=1em, -> ,shorten <=1em,  dashed, thick](BS) [out = 70, in = 175] to node[above,left, scale = 1.5]{TPC}(p2);
\draw [shorten >=1em, -> ,shorten <=1em,  dashed, thick](UE) [out = 250, in = 5] to node[below,left, scale = 1.5]{Signal}(p1);
\draw [->](p2) to node[above, left, scale = 1.5]{$\vec{v}$}(p3);
\end{tikzpicture}%}
\end{document}
 

This is the graphic that should be implemented:

enter image description here

A minimal document to insert the standalone tikz graphic is given here:

\documentclass{article}
\usepackage{tikz}
\usepackage{standalone}
\usepackage{tkz-euclide}


\begin{document}
    
\begin{figure}
    \centering
    \adjustbox{width = 0.6\textwidth}{  \input{path to standlone document}}
    \caption{case1: problem setting}
    \label{fig:probl_sett}
\end{figure}
    
\end{document}  

When I compile the second code, where I insert the standalone document, I get the following graphic: enter image description here

1
  • tkz-base now is a tool for Euclidean Geometry. You need to use tkz-base Commented Apr 26, 2022 at 16:57

2 Answers 2

0

You should include the cross style definition in your main tex file:

\documentclass{article}
\usepackage{tikz}
\usepackage{standalone}
\usepackage{tkz-euclide}
\tikzset{cross/.style={cross out, draw=black, minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt},
%default radius will be 1pt. 
cross/.default={1pt}}


\begin{document}
    
\begin{figure}
    \centering
    \adjustbox{width = 0.6\textwidth}{  \input{path to standlone document}}
    \caption{case1: problem setting}
    \label{fig:probl_sett}
\end{figure}
    
\end{document}  
3
  • Thanks a lot. This worked. Do you know, if there's also a more elegant way where I can declare my used tikzsets? In my main document I use a lot of custom code like this. And copying all of it to the beginning will look really messy. Commented Apr 26, 2022 at 17:47
  • I don't know if this is a more elegant way. I always have a separate tikzsetting.tex file. And put all the pgf and tikz related setting in that file. And every time when I start new document, I just \input{tikzsetting.tex} that file in the preamble.
    – Tom
    Commented Apr 26, 2022 at 18:37
  • thats really nice thanks Tom Commented Apr 27, 2022 at 18:21
1

In the main file you need tkz-base :

\documentclass[tikz, border=2mm]{standalone}
%\usetikzlibrary{shapes.misc}
\usepackage{tkz-base,tkz-euclide}

And in the subfile : you need only :

\documentclass{article}
\usepackage{standalone}

\begin{document}

\begin{figure}
    \centering
    \adjustbox{width = 0.6\textwidth}{%
    \input{test}
      %\input{path to standlone document
      }}
    \caption{case1: problem setting}
    \label{fig:probl_sett}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .