12

I am working on a poster template with a not so easy to reproduce style with nested blocks. To that end, I have to create a minipage whose width depends on \linewidth minus some fixed value. In a nutshell, I want to subtract something in the width specification of the minipage.

How can I express \linewidth "MINUS" 2ex in my template?

  • 3
    Just load the calc package and use \linewidth-2ex; you probably mean -2em, though. – egreg Mar 13 '13 at 12:38
  • 3
    Or precede it with \dimexpr: \begin{minipage}{\dimexpr\linewidth-2ex} – Andrew Swann Mar 13 '13 at 12:46
  • @egreg: I didn't know about the calc package. This answers the question (hint). (Note: I did mean 2ex since it is determined by a different vertical margin.) – bitmask Mar 13 '13 at 12:52
15

The calc package allows for expressing operations on dimensions in the argument to minipage, \parbox, \setlength and other places.

So, after \usepackage{calc}, you're allowed to say

\begin{minipage}{\linewidth-2ex}

Without any package the same can be accomplished by

\begin{minipage}{\dimexpr\linewidth-2ex\relax}

but calc is more powerful.

| improve this answer | |

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.