Does expl3 have alternative to settowidth and settoheight?Is there a gentle introduction to learning expl3 syntaxEmulating @ifnextchar in expl3expl3 code with tabularxDoes expl3 have arrays?Access xparse's BooleanTrue via latex3 expl3Does expl3 key-setting syntax have an equivalent of TikZ/PGF's .cd?expl3 function not expanded inside `label…`Determining the length of an expl3 sequenceHow to test a newif conditional in expl3Locally redefining ~ in code that uses expl3 facilities

Is it rude to call a professor by their last name with no prefix in a non-academic setting?

What does $!# mean in Shell scripting?

How should I introduce map drawing to my players?

Is the Unsullied name meant to be ironic? How did it come to be?

Count rotary dial pulses in a phone number (including letters)

Do I need full recovery mode when I have multiple daily backup?

Am I a new writer?

Need to understand my home electrical meter to see why bill is so high and/or if neighbor is on same meter

What is a Centaur Thief's climbing speed?

Compaq Portable vs IBM 5155 Portable PC

How to politely tell someone they did not hit "reply to all" in an email?

First Match - awk

Why did the person in charge of a principality not just declare themself king?

Why do most published works in medical imaging try to reduce false positives?

Do photons bend spacetime or not?

Remove CiviCRM and Drupal links / banner on profile form

Looking for a soft substance that doesn't dissolve underwater

Why does this if-statement combining assignment and an equality check return true?

Is Jon Snow the last of his House?

What is the difference between singing and speaking?

USPS Back Room - Trespassing?

My players want to grind XP but we're using milestone advancement

A steel cutting sword?

Can I connect my older mathematica front-end to the free wolfram engine?



Does expl3 have alternative to settowidth and settoheight?


Is there a gentle introduction to learning expl3 syntaxEmulating @ifnextchar in expl3expl3 code with tabularxDoes expl3 have arrays?Access xparse's BooleanTrue via latex3 expl3Does expl3 key-setting syntax have an equivalent of TikZ/PGF's .cd?expl3 function not expanded inside `label…`Determining the length of an expl3 sequenceHow to test a newif conditional in expl3Locally redefining ~ in code that uses expl3 facilities













2















How can I substitute following code with expl3 interfaces (that do the same job)?



documentclass[varwidth]standalone
begindocument
newlengthspaceWidth
settowidthspaceWidth
thespaceWidth
enddocument









share|improve this question






















  • your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

    – David Carlisle
    1 hour ago















2















How can I substitute following code with expl3 interfaces (that do the same job)?



documentclass[varwidth]standalone
begindocument
newlengthspaceWidth
settowidthspaceWidth
thespaceWidth
enddocument









share|improve this question






















  • your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

    – David Carlisle
    1 hour ago













2












2








2








How can I substitute following code with expl3 interfaces (that do the same job)?



documentclass[varwidth]standalone
begindocument
newlengthspaceWidth
settowidthspaceWidth
thespaceWidth
enddocument









share|improve this question














How can I substitute following code with expl3 interfaces (that do the same job)?



documentclass[varwidth]standalone
begindocument
newlengthspaceWidth
settowidthspaceWidth
thespaceWidth
enddocument






expl3 latex3 lengths






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









bp2017bp2017

1,161116




1,161116












  • your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

    – David Carlisle
    1 hour ago

















  • your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

    – David Carlisle
    1 hour ago
















your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

– David Carlisle
1 hour ago





your question title is about measuring boxes but if your actual goal is the example in the code then this is a very inefficient way to find the width of a space, that width is already available as a tex length it is fontdimen 2 of the current font.

– David Carlisle
1 hour ago










2 Answers
2






active

oldest

votes


















5














There is nothing equivalent (that I know of), but you can implement your own (and by implement I mean copy from latex.ltx and change the syntax). I defined SetToHeight, SetToWidth, and SetToDepth, that do the same as the LaTeX2e's variants.



However, for the specific case of a space, you can use fontdimen2font, which will get the width of a space in the current font without the need to measure a box, thus it is expandable, so you can use in dimension expressions. I defined an expl3y wrapper for that as well:



documentclass[varwidth]standalone
usepackageexpl3
ExplSyntaxOn
cs_new_protected:Npn __bp_box_set_to:NNn #1 #2 #3

hbox_set:Nn l_tmpa_box #3
dim_set:Nn #2 #1 l_tmpa_box
box_set_eq:NN l_tmpa_box c_empty_box

cs_new_protected:Npn SetToHeight __bp_box_set_to:NNn box_ht:N
cs_new_protected:Npn SetToDepth __bp_box_set_to:NNn box_dp:N
cs_new_protected:Npn SetToWidth __bp_box_set_to:NNn box_wd:N
% Expandable width of a space:
cs_new:Npn WidthOfSpace tex_fontdimen:D 2 tex_font:D
ExplSyntaxOff
begindocument
ExplSyntaxOn
dim_new:N spaceWidth
SetToWidth spaceWidth
dim_use:N spaceWidth
par
dim_use:N WidthOfSpace
ExplSyntaxOff
enddocument


Output:




enter image description here







share|improve this answer























  • Why __? These would need to be public

    – Joseph Wright
    2 hours ago











  • I wouldn't use l_tmpa_box.

    – egreg
    2 hours ago


















1














coffin_new:NspaceCoffin
hcoffin_set:NnspaceCoffin
% space width
dim_eval:ncoffin_wd:NspaceCoffin



box_new:NspaceBox
hbox_set:NnspaceBox
% space width
dim_eval:nbox_wd:NspaceBox





share|improve this answer




















  • 2





    You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

    – Phelype Oleinik
    8 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f492367%2fdoes-expl3-have-alternative-to-settowidth-and-settoheight%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














There is nothing equivalent (that I know of), but you can implement your own (and by implement I mean copy from latex.ltx and change the syntax). I defined SetToHeight, SetToWidth, and SetToDepth, that do the same as the LaTeX2e's variants.



However, for the specific case of a space, you can use fontdimen2font, which will get the width of a space in the current font without the need to measure a box, thus it is expandable, so you can use in dimension expressions. I defined an expl3y wrapper for that as well:



documentclass[varwidth]standalone
usepackageexpl3
ExplSyntaxOn
cs_new_protected:Npn __bp_box_set_to:NNn #1 #2 #3

hbox_set:Nn l_tmpa_box #3
dim_set:Nn #2 #1 l_tmpa_box
box_set_eq:NN l_tmpa_box c_empty_box

cs_new_protected:Npn SetToHeight __bp_box_set_to:NNn box_ht:N
cs_new_protected:Npn SetToDepth __bp_box_set_to:NNn box_dp:N
cs_new_protected:Npn SetToWidth __bp_box_set_to:NNn box_wd:N
% Expandable width of a space:
cs_new:Npn WidthOfSpace tex_fontdimen:D 2 tex_font:D
ExplSyntaxOff
begindocument
ExplSyntaxOn
dim_new:N spaceWidth
SetToWidth spaceWidth
dim_use:N spaceWidth
par
dim_use:N WidthOfSpace
ExplSyntaxOff
enddocument


Output:




enter image description here







share|improve this answer























  • Why __? These would need to be public

    – Joseph Wright
    2 hours ago











  • I wouldn't use l_tmpa_box.

    – egreg
    2 hours ago















5














There is nothing equivalent (that I know of), but you can implement your own (and by implement I mean copy from latex.ltx and change the syntax). I defined SetToHeight, SetToWidth, and SetToDepth, that do the same as the LaTeX2e's variants.



However, for the specific case of a space, you can use fontdimen2font, which will get the width of a space in the current font without the need to measure a box, thus it is expandable, so you can use in dimension expressions. I defined an expl3y wrapper for that as well:



documentclass[varwidth]standalone
usepackageexpl3
ExplSyntaxOn
cs_new_protected:Npn __bp_box_set_to:NNn #1 #2 #3

hbox_set:Nn l_tmpa_box #3
dim_set:Nn #2 #1 l_tmpa_box
box_set_eq:NN l_tmpa_box c_empty_box

cs_new_protected:Npn SetToHeight __bp_box_set_to:NNn box_ht:N
cs_new_protected:Npn SetToDepth __bp_box_set_to:NNn box_dp:N
cs_new_protected:Npn SetToWidth __bp_box_set_to:NNn box_wd:N
% Expandable width of a space:
cs_new:Npn WidthOfSpace tex_fontdimen:D 2 tex_font:D
ExplSyntaxOff
begindocument
ExplSyntaxOn
dim_new:N spaceWidth
SetToWidth spaceWidth
dim_use:N spaceWidth
par
dim_use:N WidthOfSpace
ExplSyntaxOff
enddocument


Output:




enter image description here







share|improve this answer























  • Why __? These would need to be public

    – Joseph Wright
    2 hours ago











  • I wouldn't use l_tmpa_box.

    – egreg
    2 hours ago













5












5








5







There is nothing equivalent (that I know of), but you can implement your own (and by implement I mean copy from latex.ltx and change the syntax). I defined SetToHeight, SetToWidth, and SetToDepth, that do the same as the LaTeX2e's variants.



However, for the specific case of a space, you can use fontdimen2font, which will get the width of a space in the current font without the need to measure a box, thus it is expandable, so you can use in dimension expressions. I defined an expl3y wrapper for that as well:



documentclass[varwidth]standalone
usepackageexpl3
ExplSyntaxOn
cs_new_protected:Npn __bp_box_set_to:NNn #1 #2 #3

hbox_set:Nn l_tmpa_box #3
dim_set:Nn #2 #1 l_tmpa_box
box_set_eq:NN l_tmpa_box c_empty_box

cs_new_protected:Npn SetToHeight __bp_box_set_to:NNn box_ht:N
cs_new_protected:Npn SetToDepth __bp_box_set_to:NNn box_dp:N
cs_new_protected:Npn SetToWidth __bp_box_set_to:NNn box_wd:N
% Expandable width of a space:
cs_new:Npn WidthOfSpace tex_fontdimen:D 2 tex_font:D
ExplSyntaxOff
begindocument
ExplSyntaxOn
dim_new:N spaceWidth
SetToWidth spaceWidth
dim_use:N spaceWidth
par
dim_use:N WidthOfSpace
ExplSyntaxOff
enddocument


Output:




enter image description here







share|improve this answer













There is nothing equivalent (that I know of), but you can implement your own (and by implement I mean copy from latex.ltx and change the syntax). I defined SetToHeight, SetToWidth, and SetToDepth, that do the same as the LaTeX2e's variants.



However, for the specific case of a space, you can use fontdimen2font, which will get the width of a space in the current font without the need to measure a box, thus it is expandable, so you can use in dimension expressions. I defined an expl3y wrapper for that as well:



documentclass[varwidth]standalone
usepackageexpl3
ExplSyntaxOn
cs_new_protected:Npn __bp_box_set_to:NNn #1 #2 #3

hbox_set:Nn l_tmpa_box #3
dim_set:Nn #2 #1 l_tmpa_box
box_set_eq:NN l_tmpa_box c_empty_box

cs_new_protected:Npn SetToHeight __bp_box_set_to:NNn box_ht:N
cs_new_protected:Npn SetToDepth __bp_box_set_to:NNn box_dp:N
cs_new_protected:Npn SetToWidth __bp_box_set_to:NNn box_wd:N
% Expandable width of a space:
cs_new:Npn WidthOfSpace tex_fontdimen:D 2 tex_font:D
ExplSyntaxOff
begindocument
ExplSyntaxOn
dim_new:N spaceWidth
SetToWidth spaceWidth
dim_use:N spaceWidth
par
dim_use:N WidthOfSpace
ExplSyntaxOff
enddocument


Output:




enter image description here








share|improve this answer












share|improve this answer



share|improve this answer










answered 8 hours ago









Phelype OleinikPhelype Oleinik

28.2k64794




28.2k64794












  • Why __? These would need to be public

    – Joseph Wright
    2 hours ago











  • I wouldn't use l_tmpa_box.

    – egreg
    2 hours ago

















  • Why __? These would need to be public

    – Joseph Wright
    2 hours ago











  • I wouldn't use l_tmpa_box.

    – egreg
    2 hours ago
















Why __? These would need to be public

– Joseph Wright
2 hours ago





Why __? These would need to be public

– Joseph Wright
2 hours ago













I wouldn't use l_tmpa_box.

– egreg
2 hours ago





I wouldn't use l_tmpa_box.

– egreg
2 hours ago











1














coffin_new:NspaceCoffin
hcoffin_set:NnspaceCoffin
% space width
dim_eval:ncoffin_wd:NspaceCoffin



box_new:NspaceBox
hbox_set:NnspaceBox
% space width
dim_eval:nbox_wd:NspaceBox





share|improve this answer




















  • 2





    You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

    – Phelype Oleinik
    8 hours ago















1














coffin_new:NspaceCoffin
hcoffin_set:NnspaceCoffin
% space width
dim_eval:ncoffin_wd:NspaceCoffin



box_new:NspaceBox
hbox_set:NnspaceBox
% space width
dim_eval:nbox_wd:NspaceBox





share|improve this answer




















  • 2





    You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

    – Phelype Oleinik
    8 hours ago













1












1








1







coffin_new:NspaceCoffin
hcoffin_set:NnspaceCoffin
% space width
dim_eval:ncoffin_wd:NspaceCoffin



box_new:NspaceBox
hbox_set:NnspaceBox
% space width
dim_eval:nbox_wd:NspaceBox





share|improve this answer















coffin_new:NspaceCoffin
hcoffin_set:NnspaceCoffin
% space width
dim_eval:ncoffin_wd:NspaceCoffin



box_new:NspaceBox
hbox_set:NnspaceBox
% space width
dim_eval:nbox_wd:NspaceBox






share|improve this answer














share|improve this answer



share|improve this answer








edited 8 hours ago

























answered 8 hours ago









bp2017bp2017

1,161116




1,161116







  • 2





    You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

    – Phelype Oleinik
    8 hours ago












  • 2





    You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

    – Phelype Oleinik
    8 hours ago







2




2





You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

– Phelype Oleinik
8 hours ago





You can, sure, use a coffin, however the computational overhead is much larger than for a simple box (as you edited in just now :-)

– Phelype Oleinik
8 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f492367%2fdoes-expl3-have-alternative-to-settowidth-and-settoheight%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Log på Navigationsmenu

Wonderful Copenhagen (sang) Eksterne henvisninger | NavigationsmenurSide på frankloesser.comWonderful Copenhagen

Detroit Tigers Spis treści Historia | Skład zespołu | Sukcesy | Członkowie Baseball Hall of Fame | Zastrzeżone numery | Przypisy | Menu nawigacyjneEncyclopedia of Detroit - Detroit TigersTigers Stadium, Detroit, MITigers Timeline 1900sDetroit Tigers Team History & EncyclopediaTigers Timeline 1910s1935 World Series1945 World Series1945 World Series1984 World SeriesComerica Park, Detroit, MI2006 World Series2012 World SeriesDetroit Tigers 40-Man RosterDetroit Tigers Coaching StaffTigers Hall of FamersTigers Retired Numberse