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.

Filter by
Sorted by
Tagged with
3 votes
1 answer
45 views

Changing the default length unit in tikz

Is there a way to change the default length unit in tikz to the ex unit? I have trouble while calculating complicated coordinates in tikz when I'm using the ex unit (I always get an error or a wrong ...
user avatar
0 votes
2 answers
50 views

calculate length in \newlength with \dimexpr

\documentclass[a4paper]{article} \usepackage{geometry} \geometry{showframe} \geometry{left=1cm,right=1cm,top=1cm,bottom=1cm} \begin{document} (1) \newlength{\ccc}{\dimexpr\textwidth-100pt} % ...
user avatar
  • 2,189
3 votes
1 answer
149 views

How to get length from glue

The objective of the following code is to occupy the rest of a line with a parbox. I know this is a wrong way. So, how to get length from glue? \documentclass{article} \usepackage{geometry} \geometry{...
user avatar
  • 2,189
3 votes
1 answer
48 views

How do I get the rubber components of an l3skip?

Related to my question on l3skip to \setlength. \ExplSyntaxOn \skip_const:Nn \c__par_skip { 1ex plus 0.2ex plus 0.1ex } \skip_gimme_the_stretch:NN \g__par_stretch_fp \c__par_skip % 0.2ex \...
user avatar
3 votes
3 answers
102 views

Passing a length as an argument to raisebox

To summarize it: I think \depth is losing its information somehow and I was not able to fix it. I am trying to place an image inline and to adjust its vertical position with \raisebox, like so: \...
user avatar
  • 462
3 votes
2 answers
165 views

Which length still creates the distance between the 2 boxes

I try to place 2 boxes on top of each other. I would like to define the height of the lower box and a potential gap between the boxes and the top box should use the remaining space. As you can see in ...
user avatar
  • 269
3 votes
1 answer
109 views

How to make the value of a lengh macro change with another

\documentclass[a4paper]{article} \usepackage{xcolor,pgf,etoolbox} \usepackage{geometry} \geometry{showframe} \geometry{left=1cm,right=1cm,top=1cm,bottom=1cm} \parindent0pt \begin{document} \newdimen\...
user avatar
  • 2,189
1 vote
1 answer
51 views

What is the unit of width and height in circuitikz?

\ctikzset{quadpoles/transformer core/inner=1,quadpoles/transformer core/height=2, quadpoles/transformer core/width=0.6} What are the units of the 2 and 0.6 here?
user avatar
3 votes
1 answer
83 views

Enlarging the Length of a Particular Page in the TOC to Accommodate an Additional Entry

I would like to selectively enlarge the vertical length of a particular page in the TOC to accommodate, say, a "widowed" entry. Consider the code \documentclass[openany]{book} \newcommand*{\...
user avatar
  • 4,799
1 vote
2 answers
58 views

How to make all \parbox with same height

Running the following MWE will get an ugly typeset which I think is for the reason of different heights of all thees\parboxs. My question is: As the contents of all \parbox cannot be foreseen, how to ...
user avatar
  • 2,189
0 votes
1 answer
57 views

How to \read inside a command and return the result?

As a followup of How to use file content as a numeric value for a length?, I'm trying to do this (I really need to read the data.txt file inside this new command and use the value later, when the ...
user avatar
  • 10.1k
0 votes
1 answer
53 views

Parametrization of the column width in the tabular environment

I want to set the parameter \xx to define the tabular below. However, I do not know how to expand the term (1-\xx) so the code below does not compile. I would appreciate your help. \documentclass[12pt,...
user avatar
  • 189
1 vote
4 answers
55 views

How to use file content as a numeric value for a length?

I'm trying to read the content from a file and then use it in the formula: \documentclass{article} \usepackage{calc} \newcommand\x{\input{size.txt}} \setlength\parskip{1pt * \x} \begin{document} Hello,...
user avatar
  • 10.1k
3 votes
2 answers
91 views

TikZ: Making a custom length independent from scaling

I've defined a custom length for drawing dots in tikzpicture: \documentclass{article} \usepackage{tikz} \newcommand*{\point}{1.5pt} \begin{document} \begin{tikzpicture} \filldraw (1,1) circle[...
user avatar
2 votes
1 answer
34 views

Change \jot length inside nested aligned environment

I'm using aligned environments inside an align* environment for some custom alignment. I would like the space between lines of the align* environment to be bigger than the space between lines of the ...
user avatar
  • 318
2 votes
1 answer
49 views

Use \textwidth in cm inside \pgfmathsetmacro

How to set \pgfmathsetmacro{\figurewidth}{\the\textwidth} with \the\textwidth expressed in cm? I tried with the lengthconvert package which works very well to print the text width in cm but it fails ...
user avatar
  • 169
0 votes
1 answer
51 views

How do I make a PDF form field fit a table cell?

I'd like to make a document with PDF forms in such a way that the text is justified. Obsiously, it would bean that all forms will have different width depending on the field label. The easiest way ...
user avatar
4 votes
1 answer
74 views

Why does TeX stretch more than the plus component and it's OK?

The code is as follows: \newlength{\stretchable} \newlength{\fixed} \setlength{\stretchable}{2cm plus 6cm} \setlength{\fixed}{8cm} \hbox to 10cm{|\hfil|} % the sample of a 10cm hspace \...
user avatar
  • 515
1 vote
1 answer
38 views

How to add a few pts to the length?

I'm trying to do this: \setlength\parindent{\parindent + 6pt} It is possible?
user avatar
  • 10.1k
2 votes
1 answer
79 views

How to draw \hrule based on text width?

I have a \divider command where it draws a thick hrule and a thin hrule to achieve the style I want: \newcommand{\divider}[1]{% \vskip-2pt % {% \color{black}% \hrule% }% ...
user avatar
2 votes
1 answer
32 views

Using \widthof without an intermediate variable

I know how to get the width in pt or sp of, say, the letter x in LaTeX using the calc package: \newlength{\xwidth}% \setlength{\xwidth}{\widthof{x}}% \the\xwidth{}, \number\xwidth sp.% As a C hacker, ...
user avatar
0 votes
0 answers
20 views

Get length of segment as parameter to use more command lines

I want to get the length of the line segment created by two points and save that result as a parameter to use more in other command lines. What should I do? Thanks for everyone's guidance!
user avatar
2 votes
1 answer
53 views

Get length of segments. The result is not the same in different scale

I have a marco \mylengthcm to get length of segments. But the result is not the same in different scale. What do I have to do to get the same result? Thank you for helping me. This is my code \...
user avatar
2 votes
3 answers
72 views

How to get the first length in a list

I need to get the first length in a list of lengths and store it in a variable. This is what I got so far: \documentclass[12pt,a4paper]{article} \newlength{\mylength} %% does not work at all %\...
user avatar
  • 830
1 vote
1 answer
55 views

Macro with optional parameter returning calculated length

I'm trying to define a macro returning a calculated length, but making the parameter optional breaks the macro (error Missing number, treated as zero.): \documentclass{article} \usepackage{xfp} \...
user avatar
  • 1,632
5 votes
2 answers
121 views

Use a LaTeX length for an arrow head length in TikZ

I draw an arrow in Tikz and I want to specify the length with a LaTeX length, e.g., \headlength, instead of explicitly writing the length, e.g., 2em. However, it seems that the TikZ does not like ...
user avatar
1 vote
1 answer
81 views

Scale SVG by text size

I have this file \documentclass{article} \usepackage{svg} \newcommand\mtg[1]{% \includesvg[height=8px]{#1.svg} } \begin{document} This magic card costs \mtg{R} mana \end{document} Where R.svg is: &...
user avatar
  • 309
0 votes
0 answers
83 views

Set newlength relative to another

I would like to define a new length, and set its value equal to a given fraction of an existing length, e.g. \newlength\halftext \setlength{\halftext}{0.5\textwidth} However, the second argument of \...
user avatar
2 votes
1 answer
52 views

Using \the with a multiple of a length

I'm making a table of line spacings to assist with aligning vertical skips. Here's a condensed version: \documentclass[11pt]{memoir} \pagestyle{empty} \usepackage{fontspec} \defaultfontfeatures[\...
user avatar
1 vote
1 answer
30 views

Get the value of custom (pseudo?) length

I defined a custom length for horizontal separation of subfloats through \DeclareFloatSeparators{halfgap}{\hskip0.5\columnsep} and use it on a float by float basis with \thisfloatsetup{subfloatrowsep=...
user avatar
  • 1,632
1 vote
0 answers
68 views

Balacing text on the right or left column in a two-columns paper after using a figure* environment

I'm trying to set an entire image with a frame box at the top of the page using the environment figure*. The problem comes with the last row of the text in the right column (or left one) after ...
user avatar
  • 11
1 vote
3 answers
145 views

Specific Width Columns and Center-Aligned in a Table

I want to create a table with specific column width and also I want the cells to be center-aligned. How can I do that? I tried the tabular environment, but i didn't get the wanted result. I think it ...
user avatar
  • 125
2 votes
3 answers
135 views

How to find the width of the longest line in multi-paragraph text

Question Is it possible to get the width of a multi-paragraph piece of text? For example, if I want to get the width of a single piece of text, I can do the following: \documentclass[a4paper]{article} ...
user avatar
  • 123
4 votes
2 answers
147 views

Bicolor text: height of expressions

I'd like to put bicolored text. This is what I did \newlength\myl \newlength\myh \newcommand{\bicolor}[1]{ \setlength{\myl}{0pt-\widthof{#1}}% \setlength{\myh}{\heightof{#1}}% \raisebox{0.5\myh}{\...
user avatar
2 votes
0 answers
21 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: \...
user avatar
  • 379
1 vote
1 answer
99 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 ...
user avatar
0 votes
0 answers
123 views

How can I make a form (like a contract or a request) in LaTeX and control the fields length?

I had to do very quickly a form and all I found was the command \hrulefill & \hruledots I did as in Form 1, but I wanted to make it as in Form 2, but to control the length. \documentclass{article} ...
user avatar
  • 580
1 vote
2 answers
44 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 ...
user avatar
  • 4,515
0 votes
2 answers
105 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 ...
user avatar
  • 167
0 votes
3 answers
266 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 ...
user avatar
  • 1,144
0 votes
1 answer
85 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 ...
user avatar
  • 61
2 votes
2 answers
39 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 ...
user avatar
1 vote
1 answer
265 views

changing length of line, tikz

In the code below, I want to change the length of the bottom line- the red arrow, see image attached. I am aware how to do this in a usual line of code, but this piece of code (copied and pasted to ...
user avatar
0 votes
1 answer
167 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 ...
user avatar
  • 733
2 votes
1 answer
114 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 ...
user avatar
  • 99
0 votes
0 answers
20 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} \...
user avatar
3 votes
1 answer
110 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?
user avatar
  • 2,239
1 vote
1 answer
32 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 ...
user avatar
  • 699
4 votes
2 answers
83 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 ...
user avatar
  • 317
2 votes
1 answer
36 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} \...
user avatar
  • 10.1k

1
2 3 4 5
9