# \strip@pt\textwidth gives “undefined control sequence”

I'm sure that this is something silly, but I've been beating my head against the statement \strip@pt\textwidth giving "undefined control sequence". I'm trying to modify some drawings in TikZ widths dynamically, and there's a lot of math involved due to the fact I need to support 3 page widths. It also gives me the opportunity to learn tikz and the fp package, but I need to strip the "pt" from the \textwidth statement.

I'm using this document definition: \documentclass[journal,letterpaper]{IEEEtran}

If \strip@pt is not defined, how do I define it?

edit

My minimal example:

\documentclass[journal,letterpaper]{IEEEtran}
\usepackage{fp}

\begin{document}
\newcommand\bitfieldwidth{32}
\newcommand\bitfielddivision{8}
\FPeval{\bitcolumnwidth}{(\strip@pt\textwidth) / \bitfieldwidth}
% the issue is here        ^^^^^^^^^
\begin{tabular}{|c|c|}
\hline
variable & value \\
\hline
textwidth &\the\textwidth \\
\hline
columnwidth &\the\columnwidth \\
\hline
bitcolumnwidth &$\bitcolumnwidth$ \\
\hline
\end{tabular}

\end{document}

• You can use \strip@pt only in a \makeatletter context. Can you show an example of what you're trying to do? – egreg Jun 17 '16 at 14:56
• Related: tex.stackexchange.com/questions/8351/… Even more related: tex.stackexchange.com/questions/109522/… – yo' Jun 17 '16 at 14:56
• @yo' I read those before I posted, but the \def\strippt{\strip@pt} still doesn't work because the \strip@pt is undefined for me. The crux is where/how \strip@pt is defined. – b degnan Jun 17 '16 at 15:06
• @bdegnan You have to copy the line before and the line after as well (that's what egreg was explaining and what you'd find in the first link of me). If it still doesn't work, then we need a complete minimal example – yo' Jun 17 '16 at 15:09
• @cfr yes, campa would be the best. In retrospect, egreg had the right idea but I was too ignorant of the whole thing until campa, so it should go to campa. – b degnan Jun 17 '16 at 23:23

The macro \strip@pt has @ in its name, so it can only be used in a context where @ is a letter, see What do \makeatletter and \makeatother do?

\documentclass[journal,letterpaper]{IEEEtran}
\usepackage{fp}

\begin{document}

\newcommand\bitfieldwidth{32}
\newcommand\bitfielddivision{8}
\makeatletter
\FPeval{\bitcolumnwidth}{(\strip@pt\textwidth) / \bitfieldwidth}
\makeatother

\begin{tabular}{|c|c|}
\hline
variable & value \\
\hline
textwidth &\the\textwidth \\
\hline
columnwidth &\the\columnwidth \\
\hline
bitcolumnwidth &$\bitcolumnwidth$ \\
\hline
\end{tabular}

\end{document}


You can define a “user level” macro:

\documentclass[journal,letterpaper]{IEEEtran}
\usepackage{fp}

\makeatletter
\let\strippt\strip@pt
\makeatother

\begin{document}

\newcommand\bitfieldwidth{32}
\newcommand\bitfielddivision{8}
\FPeval{\bitcolumnwidth}{(\strippt\textwidth) / \bitfieldwidth}

\begin{tabular}{|c|c|}
\hline
variable & value \\
\hline
textwidth &\the\textwidth \\
\hline
columnwidth &\the\columnwidth \\
\hline
bitcolumnwidth &$\bitcolumnwidth$ \\
\hline
\end{tabular}

\end{document}


However, you don't need fp to do this, provided you just divide by an integer:

\edef\bitcolumnwidth{\the\dimexpr\textwidth/\bitfieldwidth\relax}


will define \bitcolumnwidth as something that can be used in the context of a dimension:

\documentclass[journal,letterpaper]{IEEEtran}

\begin{document}

\newcommand\bitfieldwidth{32}
\newcommand\bitfielddivision{8}
\edef\bitcolumnwidth{\the\dimexpr\textwidth/\bitfieldwidth\relax}

\begin{tabular}{|c|c|}
\hline
variable & value \\
\hline
textwidth &\the\textwidth \\
\hline
columnwidth &\the\columnwidth \\
\hline
bitcolumnwidth &\bitcolumnwidth \\
\hline
\end{tabular}

\end{document}