# matlab2tikz scales width variable by factor 0.95092

I use global default variables \figwidth for figure width and \figheight for height in my document.

These are defined by the following code in my document header:

Latex

\newcommand{\figwidth}{0.8\textwidth}           % sets \figwidth, which can be used as default width for figures
\newcommand{\figheight}{\figwidth/1.618}        % sets \figheight, which can be used as default heigth for figures


In Matlab, I pass the aforementioned variables to matlab2tikz.m as shown below:

Matlab

x = linspace(0,5,500);
y = sin(x);

figure
plot(x,y)
title('Sine Plot')

cleanfigure;
matlab2tikz('width','\figwidth','height','\figheight');


However there seems to be some magic happening inside matlab2tikz, as it applies the factor 0.95092 to my predefined \figwidth

Latex

\begin{tikzpicture}

\begin{axis}[%
width=0.95092\figwidth,
height=\figheight,
at={(0\figwidth,0\figheight)},
scale only axis,
separate axis lines,
every outer x axis line/.append style={black},
every x tick label/.append style={font=\color{black}},
xmin=0,
xmax=5,
every outer y axis line/.append style={black},
every y tick label/.append style={font=\color{black}},
ymin=-1,
ymax=1,
title={Sine Plot}
]
table[row sep=crcr]{%
0   0\\
0.0100200400801603  0.010019872410322\\
0.0200400801603206  0.020038738821815\\
0.030060120240481   0.0300555933366527\\
//..... many more entries in table .....
4.98997995991984    -0.961718395396395\\
5   -0.958924274663138\\
};
\end{axis}
\end{tikzpicture}%


My current workaround is adding a 0 in the Matlab code:

Matlab

matlab2tikz('width','0\figwidth','height','\figheight');


which yields:

Latex

width=0\figwidth,


i.e. the end result when considering my initial definition of \figwidth reads

width=00.8\textwidth,   % = 0\figwidth


which is fine for now, but could break the code in some situations that don't involve a factor in my initial definition of the width variable. For example

\newcommand{\figwidth}{\textwidth}


would yield zero figure width:

width=0\textwidth,   % = 0\figwidth = 0


I have searched all the *.m files contained in the src folder of the matlab2tikz package for this factor but found no results in the code.

tl:dr; Does anyone know what is causing the magic factor 0.95092 and how to avoid it? Thanks a lot in advance for your help!