Questions tagged [lengths]

{lengths} is for questions dealing with measurements in TeX. If your question is about the spacing between document elements, use {spacing} instead.

The calc package is typically used in length calculations, allowing users to do

\newlength{\mylen}
\setlength{\mylen}{2pt-3em+5pc}% 29.14992pt under 11pt font

similar to plain TeX's \dimexpr 2pt-3em+5pc\relax. In pure LaTeX, the equivalent would require

\newlength{\mylen}
\setlength{\mylen}{2pt}
\addtolength{\mylen}{-3em}
\addtolength{\mylen}{5pc}
473 questions
31
votes
4 answers

Getting length as number?

I have probably formulated the question wrong, as I don't know the Tex internals - but this is what I mean; consider this example: \newcommand{\myNum}{2} \newlength{\myLength} \setlength{\myLength}{\myNum cm} Here, I'd consider \myNum to represent…
sdaau
  • 17,079
15
votes
1 answer

Why does changing \baselinestretch not change line spacing?

I have read that line spacing in a LaTeX document is controlled by the \baselinestretch macro, for example here. Setting \baselinestretch in the preamble does in fact change line spacing. When I redefine \baselinestretch inside the document however,…
Brian
  • 619
11
votes
1 answer

How to compute exact width added by \left. \right

I have defined macros to produce resizable brackets that also work across line breaks. This necessitated the use of and additional set of \left. and \right. which add a bit of horizontal space. Now, when I attempt to remove the additional space by…
Peter Grill
  • 223,288
11
votes
2 answers

Displaying rubber lengths in arbitrary units

Based on this question, I know how to show regular lengths expressed in arbitrary units. However, I need to do the same for rubber lengths (showing the plus and minus) and the printlen package doesn't support that except for pt. Is there an…
11
votes
1 answer

To display the lengths in millimeters by default

All my length are in millimetres and the command \the\mylength outputs a length in points. Idem with the \layout from the package layout. How can I display all theses lengths in millimetres (more easily understandable than the points).
user50260
11
votes
3 answers

Why is a 10bp picture environment not 10bp?

Example: \documentclass{article} \begin{document} \newlength{\picwidth} \setlength{\unitlength}{1bp} \settowidth{\picwidth}{\begin{picture}(10,10)\end{picture}} \typeout{width:…
9
votes
2 answers

Using powers in \dimexpr

The code \documentclass{memoir} \begin{document} \fontsize{\dimexpr 1.2^{3} 10pt}{\dimexpr 1.2^{3} 10pt}\selectfont Hello TeXworld. \end{document} does not work. Why not? EDIT: I need a solution that supports all integral (including negative)…
Gaussler
  • 12,801
9
votes
2 answers

Save length with \let command

I want to save \fboxsep length in \oldfboxsep and use it later. The following code doesn't work: \newlength{\oldfboxsep} \let\oldfboxsep\fboxsep % 3pt by default \setlength{\fboxsep}{8pt} \fbox{\begin{minipage}{.9\textwidth} …
Z.H.
  • 3,346
  • 21
  • 39
8
votes
3 answers

How to detect the length of the tallest letter and that of the deepest letter of the current font size?

My idea is to redefine the \strut to be as short as possible. It means the length of strut is the sum of the tallest letter length and the deepest letter length.
Display Name
  • 46,933
8
votes
1 answer

How to negate a rubber length?

Mathematically, if you negate the points from the interval [2,5] pointwise, you'd get the interval [-5,-2]. Having said that, I'd expect that if you negate 3pt plus2pt minus1pt, you'd get -3pt minus2pt plus1pt. How to actually compute these rubber…
user165772
7
votes
4 answers

How to link 2 lengths

I would really like to create a length \bar that defaults to having the same as the length \foo even if \foo gets changed, but I would also like the user to be able to set \bar to be whatever length they want. I can get close if instead of a length…
StrongBad
  • 20,495
7
votes
1 answer

em, ex, en? Which length units are font size dependent?

Length can be specified as 3em, or 3.5ex. What is required to make 4en also valid? Are there any other font related length units?
Yossi Gil
  • 15,951
6
votes
1 answer

Adding lengths with the plus and minus syntax

Is it possible to add macro lengths with manually coded numbers or with other macros in a length input, (as opposed to needing to use \addlength)? MWE: See \setlength{\xfootskip}{\xfootheight plus 0.25in} [Please do not focus on use of KOMA with…
kando
  • 1,338
5
votes
1 answer

Why \setlength doesn't work in preamble?

This is what I'm doing: \documentclass{article} \usepackage{calc} \newcommand{\foo}{0} \setlength{\foo}{2in + 3in} \usepackage[paperwidth=\foo,paperheight=\foo]{geometry} \begin{document} Hello, world! \end{document} I'm getting: ! LaTeX Error:…
yegor256
  • 12,021
5
votes
3 answers

What is the correct calculation to span some columns?

I want to create a column spanning 5 columns with m column specifier. It seems my calculation \multicolumn{5}{m{5\temp}|}{\hrulefill} is wrong as the rule does not occupy the left space. What is the correct…
Display Name
  • 46,933
1
2 3