3

Suppose I have a length \mylength, defined to be

\setlength{\mylength}{5pt plus 1pt minus 2pt}

I'd like to make \mylength a fixed length, but keep the default length. In this example, I'd like

\setlength{\mylength}{5pt}

But what if I didn't know the definition of \mylength? I know I can use \the\mylength to have it printed in the document, which I then can inspect, but I was wondering whether there is a simple way to strip out the glue of a length.

  • 1
    If you use 1\mylength the stretch and shrink components are removed. – egreg Dec 3 '16 at 11:02
  • That answers my question! – Hugh Dec 3 '16 at 11:03
2

If you use a factor in front of \mylength, the stretch and shrink components are discarded. With

\newlength{\lenA}
\newlength{\lenB}

\setlength{\lenA}{5pt plus 1pt minus 1pt}
\setlength{\lenB}{1\lenA}

the length \lenB will be set to 5pt.

If you just need to use \lenA without stretch and shrink components, the same holds:

\hspace{1\lenA}

will make a nonflexible space.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.