[Tex/LaTex] pgf Error: Arrow end type “latex”’ unknown

subfilestikz-pgf

The following document:

\documentclass[]{article}
\usepackage{tikz}
\usepackage{tikzscale}
\usetikzlibrary{trees}
\usetikzlibrary{calc}
\begin{document}
\tikzset{
block/.style = {draw, fill=white, rectangle, 
    minimum height=3em, minimum width=3em},
tmp/.style  = {coordinate}, 
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}}
}
\usetikzlibrary{shapes,arrows,positioning,calc}
\begin{figure}[ht]
\begin{tikzpicture}[auto, node distance=2cm,>=latex',every node/.style={transform shape}]
\tikzstyle{every node}=[font=\large]
    \node [input, name=rinput] (rinput) {};
    \node [sum, right of=rinput] (sum1) {-};  
    \draw [->] (rinput) -- node{$\beta_c$} (sum1);
\end{tikzpicture}
\end{figure}
\end{document}

Works fine. Now, I have a parent document of class book, and a child document (/subfile). If I put the above figure code (whether directly or using subfile) in the parent, it works fine. If I put it in the child, it give me errors:

Package pgf Error: Arrow end type ``latex''' unknown. ...tex',every node/.style={transform shape}]
Package pgf Error: Arrow end type ``latex''' unknown. ...tex',every node/.style={transform shape}]
Package pgf Error: Arrow end type ``latex''' unknown. ...tex',every node/.style={transform shape}]
Package pgf Error: Arrow end type ``latex''' unknown. ...tex',every node/.style={transform shape}]
Package pgf Error: Arrow end type ``tikze@>>@latex''' unknown. ...tex',every node/.style={transform shape}]
Package pgf Error: Arrow end type ``tikze@>@latex''' unknown. \draw [->]
Cannot patch \document,(auxhook) using \AtBeginDocument instead.
Unused global option(s): [english].
Overfull \hbox (13.70734pt too wide) in paragraph
Token not allowed in a PDF string (Unicode):(hyperref) removing `\textenglish'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
Token not allowed in a PDF string (Unicode):(hyperref) removing `\phi'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
Font shape `EU1/SimplifiedArabic(0)/m/sl' undefined(Font) using `EU1/SimplifiedArabic(0)/m/n' instead
\headheight is too small (12.0pt): Make it at least 13.9141pt.
Token not allowed in a PDF string (Unicode):(hyperref) removing `\textenglish'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
Token not allowed in a PDF string (Unicode):(hyperref) removing `\chi'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
Underfull \vbox (badness 1895) has occurred while \output is active []
\headheight is too small (12.0pt): Make it at least 13.9141pt.
Token not allowed in a PDF string (Unicode):(hyperref) removing `\textenglish'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
Token not allowed in a PDF string (Unicode):(hyperref) removing `\beta'
Token not allowed in a PDF string (Unicode):(hyperref) removing `math shift'
\headheight is too small (12.0pt): Make it at least 13.9141pt.
\headheight is too small (12.0pt): Make it at least 13.9141pt.
Some font shapes were not available, defaults substituted.

Best Answer

We don't know which kind of subfile are you using (standalone, subfiles ?) but your example shows some possible discrepancies between main file preamble and child file one. In fact, it looks like shapes, arrows and positioning libraries are only loaded when compiling the child document. If you include them in main preamble you'll solve the problem.