I am attempting to draw the dimension of a line segment for my tkz-euclide drawing while in tabular environment. For some reason this results in an error. It should be noted, that I do not have any problems with including tkz-euclide drawings in tabular environment. The error arises only when the dim parameter is used.
Here is a minimal example that results in an error:
\documentclass[a4paper, 11pt]{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tabular}{c}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(5,0){B}
\tkzDrawPoints(A,B)
% Excluding the following line removes the error
\tkzDrawSegment[dim={$5\mathrm m$, 12pt,}](A,B)
\end{tikzpicture}
\end{tabular}
\end{document}
However, the same tikz drawing works while outside of the tabular environment. For example, the following code works without any issues:
\documentclass[a4paper, 11pt]{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoint(0,0){A}
\tkzDefPoint(5,0){B}
\tkzDrawPoints(A,B)
\tkzDrawSegment[dim={$5\mathrm m$, 12pt,}](A,B)
\end{tikzpicture}
\end{document}
Apart from the tabular environment I have also tried tabu and tabularx – the error still persists.
What could have caused this error, and how I could circumnavigate it? Ideally, I would like to continue working with tkz-euclide rather than defining my own 'dim' equivalent, but any solution is welcome!
Thanks!