I'm trying to scale a tikzpicture to \textwidth like this question. And this answer suggests to use package tikzscale.
I follow the document to build an example myself:
%example.tex
\documentclass{minimal}
\usepackage{tikz}
\usepackage{tikzscale}
\begin{document}
\includegraphics[width=0.5\linewidth]{linewidth.tikz}
\end{document}
%linewidth.tikz
\begin{tikzpicture}
\draw (0,0) – node {center} (\linewidth,1);
\end{tikzpicture}
Compiling with $ xelatex example.tex, I got
! Package tikz Error: Giving up on this path. Did you forget a semicolon?.
See the tikz package documentation for explanation.
Type H <return> for immediate help.
...
l.2 \draw (0,0) –
node {center} (\linewidth,1);
What is wrong here?
\documentclass{article} \usepackage{tikz,lipsum} \begin{document} \lipsum[1] \begin{center} \begin{tikzpicture} \draw (0,0) rectangle (\linewidth,1cm); \end{tikzpicture} \end{center} \lipsum[2] \end{document}– Black Mild Jan 21 '21 at 12:07minimalclass, it is not intended for public use. Usearticleor simular – daleif Jan 21 '21 at 12:41tikzscaleis quite old, both tikz andgraphicxhave been updated quite a lot since 2013 – daleif Jan 21 '21 at 12:57