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
2
votes
2answers
37 views

How to make the arrow in a chemical formula shorter? (using mhchem)

I'm using mhchem to write a chemical formula, as in the example by clemens (shown below). Is there a way to make the main arrow -> shorter by a fixed value in the second equation? Here's the code: ...
0
votes
2answers
26 views

rule length equal to length of item text paragraph

How can I get the width of the rule equal to the text for each item paragraph ? Any advice ? \documentclass[french,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{...
8
votes
2answers
1k views

Divide two lengths

How do I divide two lengths and get a length out? \documentclass{article} \newlength\A \newlength\B \newlength\C \setlength\A{10pt} \setlength\B{5pt} \setlength\C{\dimexpr\A/\B\relax} \begin{document}...
1
vote
1answer
25 views

Ifoddpage statement inside switch case

Continuation of topics tcolorbox: specific width and height settings for odd and even pages and Distance Variable in front or back pages. I'd like to set lengths conditionally based on the expansion ...
2
votes
1answer
48 views

How to get the font size parameter passed to the main standard classes?

For complex length manipulation (see here), I would need to get the font size that was passed as an option to the document class: \documentclass[12pt]{article} \newlength{\mainfontsize} \setlength{\...
1
vote
1answer
46 views

How to do something after @ifnextchar?

In my LaTeX file, I'm using \usepackage{indentfirst}. And there I've defined a command: % ################################################## % % Coding skills % ---------- Usage example ---------- % ...
1
vote
0answers
36 views

calculate the title height and if the title height is above some number then add some space

calculate the title height and if the title height is above some number then add some space. when I use the code get the title, but when I use code like this \settoheight{\heightoftitle}{\vbox{\...
3
votes
0answers
34 views

Alignment of an un-numbered multicolumn tcolorbox listing

Consider the following code: % Preamble \documentclass[letterpaper, 10pt]{article} \usepackage{calc} \usepackage{xcolor} \usepackage{listings} \usepackage{multicol} \usepackage[most]{tcolorbox} \...
6
votes
3answers
454 views

How to get depth and other lengths of a font?

Red line in the output is \baselineskip, the only length in question that I know of. The output image provided here is an edited image in which (red line representing \baselineskip is re-positioned to ...
2
votes
2answers
80 views

Calculate metric length in LaTeX (e.g. for TikZ)

I would like to calculate the length of elements on a LaTeX beamer frame (128mm*96mm) equivalent to those on a PowerPoint slide (254mm*190.5mm), i.e. apply the factor 128/254 to a value given in mm. ...
3
votes
2answers
111 views

Does expl3 have alternative to \settowidth and \settoheight?

How can I substitute following code with expl3 interfaces (that do the same job)? \documentclass[varwidth]{standalone} \begin{document} \newlength\spaceWidth \settowidth{\spaceWidth}{\ } \the\...
2
votes
1answer
30 views

In tikz length measurement from trigonometry and from coordinates differ

I have different measurement of length with trigonometric equation using radius and theta and from coordinates. I want to solve this issue because for further computation I need to have both ...
1
vote
1answer
25 views

Dynamic length name

I want to create something like in object, that saves it's own location in latex. Because I don't know how to create a objec in latex, I want to create a length with seperating name for each object. ...
3
votes
2answers
117 views

How to properly capture return value of a command?

I have a problem with capturing returned value of my command. Here is my preamble with command definition: \documentclass[convert={density=300,size=800x600,outext=.png}]{standalone} \usepackage[utf8]...
2
votes
1answer
48 views

What units are \pgfphysicalheight and \pgfphysicalwidth defined in?

I often use \pgfphysicalheight and \pgfphysicalwidth from the pgfpages package to define sizes dynamically based on the dimensions of my page (which vary). For example, here's a "dynamic" vertical ...
1
vote
1answer
61 views

How to make inductors larger?

I'm having a problem trying to make my cute inductors larger. I found a way of making them bigger with the /tikz/circuitikz/bipoles/length but that scales the entire inductor. I just want it to be ...
3
votes
3answers
236 views

How can I separate the number from the unit in argument?

Let us say that I have a function, in which I give a number plus a unit. I would like to get only the number, is it possible ? Here is a MWE: \documentclass{article} \usepackage[utf8]{inputenc} \...
0
votes
0answers
21 views

Measure the remainder of a page if it has a title and inserting that into a dynamic command

Okay, so I'm currently writing a report (in the article class) which has a section full of chemical spectra. I figured that two spectra per page is a good number, so I write \RequirePackage{calc} \...
15
votes
4answers
2k views

7.0pt ≠ x⋅10.0pt for all x

Consider the following input: \documentclass{article} \begin{document} \newlength{\smallertopskip} \setlength{\smallertopskip}{.700004577636718749999999999999999999999999999999\topskip} \newlength{\...
6
votes
1answer
315 views

Exact Fraction of a length

I want to place some elements on my page for which I need to calculate their size. For my example lets say three of those elements should exactly occupy a \linewidth when put side by side without ...
1
vote
1answer
50 views

Set length parameter based on KOMA \ifthispageodd

Background I'm using scrrept and titlesec (changing from titlesec to pure koma is on my todo list) any I've redefined \chapter to be a full page affair. The issue is when I'm using twosided. ...
2
votes
2answers
61 views

Explicit artihmetic functions as alternative to calc

Is there a way to perform compile time arithmetic with explicit functions that respect dimensions? Here is a strawman example of arithmetic functions: \mul{4}{7} % expands to 28 \mul{4}{...
3
votes
2answers
126 views

Actual table column width is unequal with set number

I want to create a table with fixed column lengths like this: \documentclass[a4paper,12pt]{article} \begin{document} \begin{tabular}{|p{1cm}|p{2cm}|p{3cm}|} \hline 1 cm & 2 cm & 3 ...
0
votes
1answer
27 views

Format issues in longtable (left alignment of cells plus different cell lenght)

I got a longtable with rows containing more or less information. I want to achieve a left alignment because of justification errors plus different lengths in row size (horizontally). My current ...
8
votes
1answer
130 views

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

What is the difference between assignment, \setlength and \renewcommand when changing a variable?

I want to set the \extrarowheight to 0.5ex. I find the following three ways are all applicable. \extrarowheight = 0.5ex \setlength{\extrarowheight}{0.5ex} \renewcommand{\extrarowheight}{0.5ex} Just ...
2
votes
1answer
57 views

Newenvironment - find the length of input

I am trying to define a new environment where the input text is placed inside a minipage, which has width equal to the length of the input text (something like a variable width box). What I would ...
2
votes
1answer
183 views

Custom \Rightarrow and \Leftrightarrow

Is there any way to shorten the double equal horizontal lines so they do not cross the arrow tips? Also, if I can get rid of the white space between two horizontal lines, it would be perfect. My MWE:...
1
vote
1answer
59 views

Lengths not as specified

As part of an inventory tool I wanted to print the contents of my part-boxes with PDFLaTex, using the code below. \documentclass[8pt,a4paper]{article} \usepackage[ngerman]{babel} \usepackage[utf8]{...
4
votes
2answers
70 views

Can I make a flexible page length?

In my document, I have many large unbreakable boxes. Sometimes, the text will take up most of the page before a box that is a little too big to still fit. Consequently, I am often manually using \...
0
votes
1answer
68 views

text justification/comments filling the space left from equation - flalign and paragraph mode

I have equations in a flalign environment and comments that may need to be multi-liner. \parbox seems fine except I can't tell it to automatically stretch in order to fill the space from the right-end ...
3
votes
1answer
37 views

Printed length in Layouts package inaccurate?

From the layouts package manual (page 3 and 4): The textwidth is \printinunitsof{pt}\prntlen{\textwidth} which is also \printinunitsof{in}\prntlen{\textwidth} or \printinunitsof{mm}\prntlen{\...
3
votes
1answer
84 views

get width and height of character in the power

I want to create a "minus-sign" in a superscript of a letter in math mode using \rule{width}{height} to get control over the look of it. In principle, I get something to my liking, but I fail to make ...
1
vote
2answers
21 views

“Missing number, treated as zero” when returning length from function

This MWE fails when I return a length and some string (I noticed it when I tried to debug some TikZ macros I wrote). \documentclass{scrartcl} \usepackage{etoolbox} \newlength{\mylength} \setlength{\...
5
votes
3answers
153 views

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 ...
11
votes
4answers
515 views

What is the most convenient way to do general-arithmetic calculations involving lengths?

I know LaTeX can store at least two types of numbers: Dimensionless quantities (i.e. 1, pi, etc.) and lengths (i.e. 1pt, \textwidth, etc.). Is there some convenient, general way to do calculations, ...
0
votes
1answer
35 views

Is it possible to have a stretchable \parindent?

I thought that maybe some stretchability in the paragraph indentation may give TeX more freedom and help it at better typesetting some tough paragraphs. However, the following does not work. \...
1
vote
1answer
40 views

How to add an unit to a calculated value properly?

I have some trouble to understand how I ought to handle some values I calculated with fp to use them as length. It is obvious that I have to add an unit to the number to use it, but trying to do so, I ...
1
vote
0answers
46 views

showframe package exceeds few points in right side

My tags are follows: \documentclass{book} \usepackage{lipsum} \usepackage{showframe} \makeatletter \renewcommand\normalsize{% \@setfontsize\normalsize{10.9}{14}% \abovedisplayskip 7\p@ plus2\...
13
votes
3answers
2k views

A reusable newlength (no stop/break if length already defined)

Often I have separate .tikz files, which may contain stuff like \newlength{\mytmplen}; and given I'm not very original with names, the same statement ends up in multiple such files. Which turns out to ...
2
votes
1answer
74 views

Printing all predefined variables and or values

So, whenever you begin a document by giving it some class (article, memoir, etc), there are many default lengths and heights being used. What I am looking for is a way to see these without explicitly ...
3
votes
1answer
377 views

\setlength{pdfpagewidth}{8.5in} not working in sharelatex

I am writing a paper for AAAI-18, which requires the following commands to be pasted near the top of the document: \setlength{pdfpagewidth}{8.5in} \setlength{pdfpageheight}{11in}\\ Neither of these ...
1
vote
2answers
233 views

Scale images in proportion to textwidth

[I rewrite this post to address the questions posed in the comments.] First I formulate what I want to accomplish as clearly as I can. After that, I explain why I want to do that. My question: How ...
1
vote
1answer
82 views

Standalone build command does not capture all length

I am working with standalone sub-file in build mode. I would like to pass lengths from the main file to the sub-file. To do so, according to this answer , I put it in the command used by standalone to ...
0
votes
1answer
103 views

\hrule length inconsistent

I'm using the tufte-book document class. When I use \hrule, sometimes it extends the text width (which I want), and other times it extends the full page width, apparently randomly. How can I get it ...
2
votes
2answers
148 views

Store result of \ratio calculation for repeated use

I am using pdflatex with the beamer package to create a presentation template that is similar to the PowerPoint template provided by my company. I want the company logo to have the same size in my ...
0
votes
0answers
36 views

How to set white space under figure to specific figure?

I don't want to do this in the preamble to set it for all figures. I want to have this for one specific image / figure. Is this possible? If so, how can I do this? \setlength{\belowcaptionskip}{2ex} ...
0
votes
2answers
157 views

Can't properly calculate column width

Please consider this MWE: \documentclass[11pt, a4paper]{article} \begin{document} \begin{table}[h] \begin{tabular}{|p{40mm}|p{100mm}|} Company & Head Quarters\\ \hline Foo Bar ...
9
votes
3answers
961 views

Centering a slash (not) over a (mathematical) glyph?

My aim is to construct a relational symbol which is graphically equivalent the standard infinity sign (coded by\infty) crossed exactly in the middle of it. Yet I am not able to overcome something. To ...
23
votes
6answers
531 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 ...