TransWikia.com

Getting the length printed as a length in pt

TeX - LaTeX Asked by Tork on March 16, 2021

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 possible answers.

I’d actually like to go even further and obtain the length of something like | {footnotesize hey}

this is an image

Did I miss something unusually simple or is it just a standard beginner Latex problem?

UPDATE: I’d like to obtain the lengths in point as a return. Or any other small metric like sp. So say the length of | {footnotesize hey} was equivalent to X pt I’d like to see X pt returned in the documents’ PDF.

UPDATE2:
Here is an example code of what I would like to use the received length for in this specific case; sorry for the inconvenience so far! Hope this clears up things.

documentclass[a4paper,10pt]{article}

usepackage[backend=biber, style=alphabetic, isbn=true, url=true, doi=true]{biblatex}

usepackage{multirow}
usepackage{array}
newcolumntype{L}[1]{>{raggedrightletnewlinearraybackslashhspace{0pt}}m{#1}}
newcolumntype{C}[1]{>{centeringletnewlinearraybackslashhspace{0pt}}m{#1}}
newcolumntype{R}[1]{>{raggedleftletnewlinearraybackslashhspace{0pt}}m{#1}}

setlength{tabcolsep}{7pt}

usepackage{calc}


begin{document}

begin{tabular}{ R{107pt} | L{278pt} | }

Something
    & Something else 
    & Something else 
    & begin{tabular}{ @{}l l L{widthof{| some other text}} | }
            Some & thing & {| some text} 
            Some & thing & {| some other text} 
      end{tabular} 

end{tabular}

end{document}

This is what I’d like to receive:
enter image description here

One Answer

As far as I can tell you are looking for settowidth

enter image description here

documentclass{article}

usepackage[T1]{fontenc}

newlengthzzz
begin{document}

[hey]

settowidthzzz{hey}

[hspace{zzz}] (thezzz)

bigskip

[| {footnotesize hey}]

settowidthzzz{| {footnotesize hey}}

[hspace{zzz}] (thezzz)

end{document}

Correct answer by David Carlisle on March 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP