I've seen \dimexpr used in the context of setting the width of the columns of a two-column table:
\newlength\q
\setlength\q{\dimexpr .5\textwidth -2\tabcolsep}
\noindent\begin{tabular}{|p{\q}|p{\q}|}
...
However, I am not sure what \dimexpr .5\textwidth -2\tabcolsep means here because I don't know what \dimexpr means. I've found the question formal syntax rules of \dimexpr \numexpr \glueexpr, but it doesn't explain what \dimexpr is.
\dimexprevaluates an expression involving dimensions. – Henri Menke May 17 '21 at 11:17\dimexpr .5\textwidth -2\tabcolsepevaluates to0.5 * \textwidth - 2 * \tabcolsep? – mhdadk May 17 '21 at 11:21\relaxafter the expression one wants to evaluate using\dimexpr(and friends) to stop parsing. Most of the time this doesn't hurt, but could result in unwanted behaviour if one forgets the\relax. – Skillmon May 17 '21 at 11:46\the\dimexpr.... Here,\thecauses the internal length that follows to be typeset as a string. This is useful sometimes when you need to store the dimension for later use or visual inspection. p.s.\dimexprstands for "dimensional expression". – Steven B. Segletes May 17 '21 at 11:563\dimexpr2pt+1pt\relaxwould equal the internal representation of 9pt, whereas3\the\dimexpr2pt+1pt\relaxwould equal the string33pt(i.e., a3concatenated with3pt). – Steven B. Segletes May 17 '21 at 12:06\q=0.5\textwidth \advance\q by -2\tabcolsep. – John Kormylo May 17 '21 at 13:18\dimexprlike this:\dimexpr{...}? I get a "missing number, treated as zero." error. However, I get no errors if I write\dimexpr(...). – mhdadk May 17 '21 at 13:50\dimexprshould be used (you linked to a question at the end of your post; this is explained in that post). If you want to visually delimit the arguments to\dimexpr, you should follow Skillmon's suggestion and write\dimexpr .... \relax. – Willie Wong May 17 '21 at 14:01