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.
473
questions
2
votes
0
answers
24
views
How to Set Left Align in the Table Whose Length is Set [duplicate]
I have a problem with this table. I want to set the right column (whose is set by p{9cm}) to be left align, but if I replace it with l{9cm}, it will be error. How to solve it?
Here is my code:
\...
1
vote
3
answers
310
views
Command to return both font size class and font size in pt
I am looking for a command to return both the font size class and the font size in pt.
The following approach from @Alan Munn as per this SE post prints font-size values for all standard classes:
\...
1
vote
1
answer
225
views
tikz or tikzmath messing up units?
I would like to work on variable using different kinds of latex unit of length.
I'm declaring variables including the units, but it's making a big mess. If a unit is given in a calculation, the length ...
1
vote
2
answers
57
views
Define a command to skip to an integer multiple of a length unit
I wish to define such a command with which one can skip to a horizontal position that is an integer multiple of 1em. For example, if one is at the position 1.2em from left, then with this command one ...
0
votes
2
answers
197
views
How do I get the length (number of digits) of a number [closed]
In answer to another question, I reported that the square of a string of all ones would yield a number with digits that ascend to the number of original ones and then descend to one again.
For ...
0
votes
3
answers
1k
views
\leftmargin length not working in enumerate environment
I need to write down arguments that are made up of numbered claims and where the conclusion is marked by a conclusion symbol. I have no problem modifying the way enumerate labels are displayed to have ...
0
votes
1
answer
383
views
Getting the length printed as a length in pt
in Getting length as number? I've seen a way to find out the length of \textwidth.
However, when instead using for example \getlength{hey} I receive an error. That occurred when using the code of all ...
2
votes
2
answers
51
views
Replacing length registers in expressions
I have some understanding on how to use length registers for calculations. However, I always end up requiring way too many length registers for tasks which could probably be solved better by ...
0
votes
1
answer
419
views
Using Tikz package to extracting length, coordinates and assigning them to variables
The code below is extracted from:
"\internalforces" command in stanli package
(code exam1b - The second coding set in this example)
and
Using reference points in "Stanli"
Is there ...
4
votes
2
answers
317
views
How align paragraph with labels before resume enumitem list
I have an enumerate list created with enumitem that I interrupt and then resume. Between the last item before the interruption and the first after the resumption, I insert a text paragraph. How can I ...
2
votes
1
answer
265
views
Test for substring with expl3 in argument of \setlength
I want to test if a string contains a substring. I finded good answers in this question. But I encounter a problem with the first answer of egreg using expl3 and I don't get the same problem with ...
0
votes
0
answers
21
views
Setting length using `plus` operator not calculating as expected [duplicate]
Consider the following MWE:
\documentclass{article}
\usepackage{blindtext}
\newlength\myheight
\newlength\mypadding
\setlength{\myheight}{2em}
\setlength{\mypadding}{5em}
\begin{document}
\...
3
votes
1
answer
235
views
How to insert space of length of 1/4 spacing?
When preparing a paper, the editor asked me to replace the separator , in numbers like $150,627,005$ with a 1/4 spacing.
So how to insert space of length of 1/4 spacing?
1
vote
1
answer
50
views
Context-sensitive length "units" in LaTeX
I would like to include in some macro a separating space that is "context-sensitive" (in the sense that when the macro is called, for example, inside a subscript, the separating space ...
4
votes
2
answers
106
views
Normalizing space after stacked characters in LaTeX: Typesetting o͘
I am attempting to typeset the o͘ character in LaTeX by stacking a raised period on top of the letter o. The spacing for the results I've achieved is inconsistent, as you can see in the below ...
2
votes
1
answer
71
views
How to use \input inside \setlength?
I'm trying this:
\documentclass{article}
\usepackage{calc}
\newlength{\foo}
\newcommand{\zzz}{\input{size.txt}}
\setlength{\foo}{2in * \zzz}
\usepackage[paperwidth=\foo,paperheight=\foo]{geometry}
\...
4
votes
2
answers
294
views
Why can't I multiply size by integer in calc?
This is what I'm doing:
\documentclass{article}
\usepackage{calc}
\newlength{\foo}
\newcommand{\zzz}{5}
\setlength{\foo}{\zzz * 2in}
\usepackage[paperwidth=\foo,paperheight=\foo]{geometry}
\begin{...
5
votes
1
answer
943
views
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!...
1
vote
1
answer
78
views
How to get the number of a length without the unit?
I am trying to draw a box whose dimensions are related to the size of the page. I can calculate the height and width of the box in \length terms (which include the length unit; e.g., 55.5pt). However ...
2
votes
1
answer
110
views
How to recover value of current line spread?
I want to set linespread to a value then go back to the previous value it had. How do I do it?
Something like:
\let\oldlinespread\linespreadvalue
\linespread{1}
\printmystuff
\linespread{\...
2
votes
0
answers
35
views
Measuring maximum height of row within align
Is there a way to extract the maximum height of a row within an align environment? For example, given
\begin{align}
a &= \frac{1}{2}\\
b &= 0.25
\end{align}
I would like to extract the height ...
-1
votes
2
answers
112
views
Length of a one line string
In the following TNWE (Tiny Not Working Example), I would like to align the braces on the right by calculating the lenghts of the texts such as to use \kern to fill spaces on right. Maybe blackmagic ...
2
votes
3
answers
111
views
witharrows - Problem to use a length given by \settowidth
The following code doesn't use the offset given by \myl. What am I missing ?
\documentclass{article}
\usepackage{witharrows}
\newlength\myl
\newcommand\doublearrow[2]{
\settowidth\myl{#1}%plus ...
2
votes
1
answer
64
views
Centered text, but at almost equal line lengths
My goal is to typeset a short, centered text in a way that the difference in line lengths is minimal. Or, to put it differently: In a way that the width of the block is minimal without increasing its ...
0
votes
2
answers
721
views
Align & match length of \rightarrow and \xrightarrow
In the following example, I want to make \rightarrow be the same length as the \xrightarrow, while aligning the two.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\...
0
votes
1
answer
249
views
How can I use "0pt plus 1fil + \baselineskip" as a length?
I'm trying to declare a new section command in KOMA-Script which is formatted exactly like part.
According to the user guide the default for beforeskip is 0pt plus 1fil + \baselineskip. Unfortunately ...
1
vote
1
answer
349
views
TikZ-matrix over whole textwidth
I try to create a TikZ-matrix like that:
where bot rows had the height ca. 3cm. row 2 column 1 is planed as something like a multicolum.
But in the first I have problems with the last column of row ...
2
votes
2
answers
213
views
Using \setlength inside \mathchoice
I've written some somewhat complex tikz macros which use a length to set their scale. I've realised I want them to have a different scale when used inside display math versus inline math mode, and I ...
0
votes
1
answer
42
views
Why is this space being inserted when using \newcommand and \setlength? [duplicate]
I'm trying to debug some \newcommand macros I'm working on, and I've got it down to this minimal example. All it does is define two lengths and then set their values - it doesn't use them for anything....
2
votes
3
answers
492
views
How to set a length to the min of two other lengths?
I have declared several lengths in my document: \bottomMargin \topMargin and \initialPaperHeight.
Right now, I am doing this
\AtEndDocument{%
\global\paperheight\dimexpr\pagetotal + \bottomMargin + ...
2
votes
1
answer
590
views
\settoheight is slightly shorter than actual height
I am trying to set a length to the height of a heading. I have the following snippet.
% heading height
\settoheight{\headingh}{\Huge{\textbf{\heading}}}
\centering\Huge\textbf{\heading}\rule{0.1mm}{\...
16
votes
2
answers
8k
views
Minimum length for \xrightarrow
I want to place text over arrows. The obvious choice is to use the amsmath command \xrightarrow{#1} However, sometimes the text above may be a single digit:
%Example 1
\xrightarrow{1}
other times ...
75
votes
4
answers
114k
views
Determine text width
For sizing figures in LaTeX it's helpful to know how wide the text is so that figures can be sized to match without rescaling. LaTeX provides \textwidth for reference by other commands, e.g.
\...
6
votes
3
answers
389
views
\somepenalty=10000 vs. \somepenalty 10000 vs. \somepenalty10000
Replacing the equality symbol with a space below or omitting the symbol at all
\documentclass{article}
\pagestyle{empty}
\usepackage{lipsum}
\begin{document}
\interlinepenalty=10000
% or \...
0
votes
1
answer
56
views
How to properly halve the inter-line distance in a math block environment
... of amsmath or mathtools? In other words, how to properly halve \jot?
Options:
\setlength{\jot}{.5\jot\relax}
\setlength{\jot}{\dimexpr.5\jot\relax}
\setlength{\jot}{\dimexpr\jot*.5\relax}
\...
1
vote
1
answer
169
views
align environment multiline equations - starting equality and inequality slightly from left the avoid page cutoff
I am using align environment to write quite huge multiline equations. The following latex source code generates the following screenshot
\begin{align}
\Bigl\|\sum_{i=1}^{k-1}\phi(s_t^i,a_t^i)[\...
0
votes
1
answer
432
views
Chemfig: fixed bond length and vertical alignment
I have two reaction schemes and one is a skeletal representation. I want all of my bonds to be a certain length, so I set the option fixed length = true and atom sep=1.5em. This gives me the above ...
1
vote
1
answer
216
views
Relax a command within an environment
A new environment is to be designed which prints some length. The environment is used multiple times in the document, hence the length is calculated more than once, leading to error "command #length# ...
3
votes
1
answer
3k
views
Powerpoint-like animations with beamer and the animate package
I want to achieve a simple "fly-in"-animation with LaTeX by utilizing the animate-package. My idea was to insert an \hspace with decreasing length-argument. However, there is no animation at all.
MWE ...
4
votes
1
answer
363
views
Setspace package changes behavior of \abovedisplayskip
When using the spacing environment from the setspace package, it appears that rubber lengths in \abovedisplayskip and \belowdisplayskip are being ignored.
\documentclass{article}
\usepackage[nopar]{...
2
votes
1
answer
1k
views
negative character space (negative version of `\ `)
There is a negative thinspace \! which is a negative version of \,.
Is there a negative version of normal character space \ too?
I could not find it in: Lengths and when to use them, What commands ...
1
vote
1
answer
292
views
Tikz: use latex length for length of path (ditto marks)
I want to draw a ditto line, which is a horizontal line with two small marks in the middle.
My first attempt was \dittoLatex which uses a box with characters and rules, but is frankly ugly.
My ...
3
votes
1
answer
517
views
tikz arithmetic with numbers and lengths
Consider this example:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\def\starty{3}
\def\length{1};
\coordinate(a1) at (1, \starty);
\...
26
votes
6
answers
751
views
Test if a given control sequence is a length register
I'm in need of a macro which receives a control sequence as argument and needs to branch if this macro is actually a length (of any kind, e.g. dimen, skip etc.) or "just" a normal macro (including one ...
1
vote
3
answers
321
views
\def, math, and order of operations, expansion?
I have what looks like a simple task but I cannot seem to get it to work.
take the following:
\def\varlength{1in}%has units
\def\varscalar{0.2}%does not have units
\raisebox{\varscalar\varlength}[...
4
votes
1
answer
107
views
Shortening lengths in LaTeX
I'm trying to create a a bipartite object that has the \textwidth at most, and doesn't overflow from the right, but has the width of the separator given as an argument.
I attempted to achieve this ...
2
votes
1
answer
116
views
How to put a text over symbols, part 2
Building on How do I put text over symbols? I created a new command :
\newcommand{\myequ}[1]{\stackrel{\mathclap{\normalfont\mbox{#1}}}{=}}
which gives overwriting :
when #1 is too long. Is there a ...
23
votes
2
answers
9k
views
How can the dimensions of a box be retrieved with LaTeX
One can specify a box in LaTeX, using various methods for example:
\newsavebox{\Abox}
\savebox{\Abox}{\parbox{4cm}{\lorem}}
\usebox{\Abox}
How can I retrieve the width, height and depth of the ...
2
votes
1
answer
78
views
Why does `settowidth` not work inside `foreach`?
I would expect the first two a to be wide apart on the first line..
\documentclass{report}
\usepackage{tikz}
\begin{document}
\newlength{\mylength}
\foreach \i in {dum,iteration} {%
\...
5
votes
1
answer
345
views
How to Set Lengths (Glue/Skips?, not Dimensions), in LuaTeX?
I am trying to define a length, (not a dimension)—using Lua. But, I am having trouble with the syntax. I think I am supposed to be using the same structures/prototypes as glue_spec in order to still ...