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.

266
votes
2answers
283k views

Lengths and when to use them

There are many lengths in LaTeX. For instance, \enskip, \enspace, \quad, \parskip, \smallskip, ... Some of them are mostly used for vertical spacing, some others are mostly used for horizontal ...
7
votes
2answers
3k views

medskipamount, default value in article class

What is the default value of medskipamount in the article class? I have not been able to locate this information. Is there some database where default values of various parameters can be accessed?
5
votes
2answers
121 views

Splitting bibliography alphabetically: how to vertically align margin note?

Context: Since my bibliography is constituted of 200+ entries, I want to add margin-notes at each new letter to split the bibliography alphabetically. (I.e., print a "B" in the margin next to the ...
0
votes
1answer
70 views

How to parsing a length with skip/rubber/glue? [duplicate]

Others have asked about getting length as a number; the solutions there (using \strip@pt to remove the units, or using \number to convert to an integer number of sp units) work fine for a regular ...
4
votes
2answers
99 views

Wrapping a length

I've cobbled together the \basis macro which sets and gets a hidden/internal length \b@sis. It is meant to work as follows : Calling \basis returns the value of \b@sis Calling \basis{} sets \b@sis to ...
0
votes
1answer
667 views

Specifying the length of \hline

$\left[\begin{matrix} u(\lambda)\\\hline v(\lambda) \\ \end{matrix}\right]$ $\left[\begin{array}{c} u(\lambda)\\\hline v(\lambda) \\ \end{array}\right]$ In the first code ...
3
votes
0answers
148 views

Can one use the Potrzebie unit system in (La)TeX?

Inspired by a comment to this answer (and some wasted but entertaining time on the internet), I was wondering if somebody has implemented the use of the Potrzebie unit system in (La)TeX, as a tribute ...
3
votes
1answer
2k views

beamer: How to get height for frame content [duplicate]

I want to put a picture in a beamer slide and make it use all the available height of the frame. So I tried: \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{graphicx} \begin{document} ...
6
votes
1answer
381 views

LuaLaTeX: Calculate length in Lua

I apologize if this a rookie question, but I find it extremely hard to find a solution to my Lua problem using online searches and browsing reference manuals. I would like to calculate a length: ...
45
votes
5answers
20k views

How can I change the indentation in quote and quotation environments and commands?

I need to change the indentation that the quote and quotation environments and commands employ. I assume that there is some length I need to set, but I've googled around, and cannot find what I am ...
3
votes
2answers
127 views

Using skip (glue) with pgfmath (truncating plus/minus parts from a glue length)?

Consider the following MWE: \documentclass{article} \usepackage{tikz} \newlength{\tlen} \newlength{\tlenB} \begin{document} \setlength{\tlen}{2cm} \typeout{check 1, tlen is: \the\tlen} \...
2
votes
1answer
86 views

Get pseudo-length value in scrlttr2

I am customizing a scrlttr2 template. I'd like to use some pseudo-length values to define other ones. For example, I defined \@setplength{firstheadhpos}{2.10cm} and I'd like to define the pseudo-...
2
votes
1answer
78 views

Decrease the length between title and content of resume

\documentclass[11.8pt,a4paper,sans]{moderncv} \usepackage{verbatim} % moderncv themes \moderncvstyle{classic} \moderncvcolor{blue} % character encoding \usepackage[utf8]{inputenc} % ...
2
votes
1answer
67 views

Framed minipage wrong size in PDF [duplicate]

I am trying to make a document containing a box with text that i want to appear a certain exact size when i print it. (Specifically I want to make a nametag that fits exactly inside a slot on my ...
2
votes
1answer
365 views

Change \topsep in a list without packages

Consider this code \documentclass{article} \usepackage{lipsum} \begin{document} \setlength{\topsep}{3\baselineskip} %\setlength{\partopsep}{3\baselineskip} \hrulefill \begin{enumerate} \itemsep=...
7
votes
4answers
252 views

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 ...
3
votes
1answer
76 views

TikZ: Using current length inside scope environment

Following this answer: Drawing on an image with TikZ, I'm using \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{some_image.jpg}}; ...
3
votes
1answer
176 views

Remove stretch and shrink (glue) from existing length

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 \...
1
vote
2answers
69 views

How to determine the partial heights of a font

I want to determine the heights of a font. \f@size gives me the total height of the line. This should be top line to bottom line. How can I determine the length between top and 2 (fat) and the length ...
7
votes
1answer
133 views

Notation for lengths

I've noticed that when you set length, you can not only write \setlength{X}{3.14cm} but \setlength{X}{=3.14cm} as well. It looks like there is not any difference between those notations but I'd like ...
1
vote
1answer
69 views

Stacking lengths and pop them off

I have an outstanding post about a TiKZ underliner (which has a bounty running for the TikZ 'pro' who find the solution). The only thing I need to solve is to add an xshifter of \@totalleftmargin to ...
28
votes
3answers
1k views

Make my infinite squares math-proof

I created a command that makes a square of text in ever-decreasing sizes to create the effect of infinite decrease. But if I increase the starting width, or change the scale factor, TeX has an ...
4
votes
2answers
750 views

Draw a line under a figure that match the figure lentgh

I am using a line under a figure to make it more aesthetic. I am having a problem with matching the line length with the figure length. Here's a MWE. \documentclass{article} \usepackage[utf8]{...
7
votes
1answer
137 views

create spacing command that eliminates extra spaces after

After a \section command, there is the same amount of space regardless of what follows. An itemize environment does not add extra space. How can I achieve the same behavior after a custom environment?...
3
votes
1answer
182 views

using \textheight and \baselineskip in scrartcl

I want to tell nomencl to print all items on a single page. If I use \documentclass{article} my code to let LaTeX compute the right length for nomitemsep itself works fine. But if I use \...
2
votes
1answer
46 views

How can i keep image sizes, defined by x\textwidth, after change of the textwidth?

i set up all image sizes by x\textwidth. Unfortunately i have to turn in the paper with another textwidth. Is there a possibility to keep the image sizes exactly like they are right now?
5
votes
1answer
144 views

If I need to set width to text width, how can I restore it later?

What is the syntax for storing some width in order to change it temporarily and then restore to the original? Example: %save length here \setlength\somewidth{\textwidth} some text \begin{...
1
vote
1answer
73 views

Difference of lengths

This should be a very basic problem, but I can't find it anywhere: \documentclass[tikz,border=1pt]{standalone} \usepackage{fp} \usetikzlibrary{fixedpointarithmetic} \newlength{\radiustai} \...
5
votes
1answer
1k views

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?
1
vote
1answer
150 views

changing \itemsep only at top level of list environment

I'm not a LaTeX programmer, but I have to deal with this bit. I have a class file defining a questionlist environmet. This is a list environment which can be nested. I want the \itemsep to be set ...
4
votes
1answer
5k views

How to set the radius of rounded corners relatively to default unit

Background: When I draw a tikzpicture, I use only the default units (i.e. I do not specify any unit, as in \draw (0,0) -- (1,1);). Issue: When no unit is given in the [rounded corners = <value>]...
1
vote
1answer
671 views

Remove vertical space between two includegraphics, without random negative vspaces

everyone. I've lost hours on this dumb problem: if I write something like this \includegraphics{img}\\* \includegraphics{img} a noticeable vertical space appears between the two images when I'm ...
2
votes
2answers
739 views

What is the difference between ‘truemm’ and ‘mm’ etc.? [duplicate]

Sometimes I see the use of truemm (or true mm) instead of mm (same for other units). So I’m wondering what is the difference between these? Or: Why are some units false?
36
votes
2answers
1k views

What is truecm?

In examples found around the web, some people specify lengths such as width=5truecm with \includegraphics or the geometry package. How is this different from regular 5cm?
10
votes
2answers
2k views

Decrease length of underscore character in normal text (gender_gap)

I use the underscore character _ in normal text mode (not typewriter). However, it is quite long. How can I decrease its length so that it is shorter? I followed the Tex FAQ on how to typeset an ...
3
votes
3answers
76 views

Disappearing custom length in enumitem

I am setting a custom length to equal the value of \leftmargin inside an enumitem list. Once I exit the list though the value disappears and my custom length reverts to zero. I have shown the ...
359
votes
4answers
238k views

Difference between \textwidth, \linewidth and \hsize

The three lengths \textwidth, \linewidth and \hsize seem to all hold the width of the current line. At least I never saw some real difference between \textwidth and \linewidth in my code. Both seem to ...
3
votes
1answer
452 views

Fancyhdr sets wrong headheight

I am having some issues with fancyhdr setting my \headheight. The package seems to add too much \headheight. This is my current set up: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[...
1
vote
3answers
406 views

How to convert \textwidth to mm and use the number as a command?

I am trying to convert \textwidth to other units I want and do calculations with the number (without the unit). How does one do this?
4
votes
1answer
214 views

Use temporary length \dimen255, temporary count \count255

This Question is mainly important for package writing: I read in the TeX-Book that \count255 and \dimen255 are traditionally used for temporary. Now the number of registers has risen (see this ...
1
vote
1answer
94 views

Convert count into length

I want to decrease a length by a number (count). I tried some variations with \newlength{\temp} and \addtolength but I got problems there with the minus. I also tried variants with \dimexpr. The ...
3
votes
2answers
456 views

How to use \beamer@frametitle value as an argument to \settowidth

I was customizing a beamer theme that have to be used by many people at my workplace. I want to show an error whenever frame-title takes more than two lines. Please don't ask why title is so long. So ...
1
vote
1answer
306 views

Is there a simple way to create a local length

I want to redefine \textheight and \textwidth inside a \parbox. \textwidth works pretty well so far. But the textheight-part works only with the help of a \newlength. Unfortunately the \newlength will ...
3
votes
1answer
424 views

Why the measurement of vertical distance between two points is wrong?

Please, consider the following (not so minimal) MWE. Why the distance between points named a3 and b3 is not the same as the vertical distance between points a2 and b2 (it is about 30% larger)? From ...
1
vote
2answers
254 views

\foreach and \StrLen

I don´t know how to make a foreach with a StrLen inside it, is it possible? \documentclass[a4paper,12pt,hidelinks]{article} \usepackage[utf8]{inputenc} \usepackage[brazil]{babel} \usepackage[T1]{...
2
votes
2answers
472 views

Why is \setlength ineffective inside a tabular environment?

Why is \setlength ineffective inside a tabular environment? Here is an MWE: \documentclass{article} \newlength{\globallength} \newlength{\locallength} \begin{document} \setlength{\globallength}{10pt}%...
1
vote
0answers
64 views

How to find the length of a remaining line? [duplicate]

I'd like to put some lines on a page where a student can answer a question, and I'd like that line to go from the prompt to the right edge of the text. The most simpleminded and (therefore?) ...
3
votes
2answers
72 views

calc package and global lengths problem in tabularx

The output of the following code is affected whether calc package is included or not: \documentclass{article} \usepackage{tabularx} % \usepackage{calc} \newsavebox{\testbox} \newlength{\testlen} \...
2
votes
3answers
1k views

How to setup a longtable with booktabs and a colored (head) row

I'd like to make a longtable with the first (head) row colored in grey. Since booktabs inserts white space below the \toprule and above the \midrule, i need to insert a colored rule: \newcommand*{\...
4
votes
2answers
163 views

Sort array of words by length

I have a long array of words which I need to show in increasing order of length. I have tried to use the package arraysort and customize a comparator. My simplified code is: \documentclass{article} ...