Extra space in cells when using token lists to build tabular contentHow do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?Lines (rules) and multicolumn in tabular content built with token listsError when using tabular environmentUsing Expl3 token-list variables where token lists are called forBuild tabular content via foreachExtra space when using tabular and overlayCells of equal width using tabularHow to remove extra vertical space between vertically merged cells?Using token lists in a newenvironment definitionRemove extra space between in figure and table listsalignment of text in rows when using lists with tabularRemove extra space in cells with smaller font size
How do I minimise waste on a flight?
What detail can Hubble see on Mars?
And now you see it
Select list elements based on other list
Extracting the parent, leaf, and extension from a valid path
Employee is self-centered and affects the team negatively
My C Drive is full without reason
Is throwing dice a stochastic or a deterministic process?
In a series of books, what happens after the coming of age?
How to increase row height of a table and vertically "align middle"?
Would a legitimized Baratheon have the best claim for the Iron Throne?
shebang or not shebang
Did any early RISC OS precursor run on the BBC Micro?
Why is the blank symbol not considered part of the input alphabet of a Turing machine?
What does “two-bit (jerk)” mean?
A♭ major 9th chord in Bach is unexpectedly dissonant/jazzy
If quadruped mammals evolve to become bipedal will their breast or nipple change position?
Game artist computer workstation set-up – is this overkill?
Why did Gendry call himself Gendry Rivers?
What's weird about Proto-Indo-European Stops?
cd ` command meaning and how to exit it?
How is it believable that Euron could so easily pull off this ambush?
How does jetBlue determine its boarding order?
How do I give a darkroom course without negs from the attendees?
Extra space in cells when using token lists to build tabular content
How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?Lines (rules) and multicolumn in tabular content built with token listsError when using tabular environmentUsing Expl3 token-list variables where token lists are called forBuild tabular content via foreachExtra space when using tabular and overlayCells of equal width using tabularHow to remove extra vertical space between vertically merged cells?Using token lists in a newenvironment definitionRemove extra space between in figure and table listsalignment of text in rows when using lists with tabularRemove extra space in cells with smaller font size
What part of my code is causing the misalignment of the first column? The extra space seems to increase with the number of rows. (Part of my code is from How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?)
Code:
documentclassarticle
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
makeatother
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2
addtabtoks\
newenvironmentmytabular%
resettabtoks
tabularllrrl
%
printtabtoks
endtabular
begindocument
beginmytabular
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument
Output:

tables token-lists
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
What part of my code is causing the misalignment of the first column? The extra space seems to increase with the number of rows. (Part of my code is from How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?)
Code:
documentclassarticle
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
makeatother
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2
addtabtoks\
newenvironmentmytabular%
resettabtoks
tabularllrrl
%
printtabtoks
endtabular
begindocument
beginmytabular
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument
Output:

tables token-lists
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
What part of my code is causing the misalignment of the first column? The extra space seems to increase with the number of rows. (Part of my code is from How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?)
Code:
documentclassarticle
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
makeatother
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2
addtabtoks\
newenvironmentmytabular%
resettabtoks
tabularllrrl
%
printtabtoks
endtabular
begindocument
beginmytabular
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument
Output:

tables token-lists
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What part of my code is causing the misalignment of the first column? The extra space seems to increase with the number of rows. (Part of my code is from How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables?)
Code:
documentclassarticle
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
makeatother
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2
addtabtoks\
newenvironmentmytabular%
resettabtoks
tabularllrrl
%
printtabtoks
endtabular
begindocument
beginmytabular
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument
Output:

tables token-lists
tables token-lists
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked May 3 at 13:33
rogue.whistlerrogue.whistler
604
604
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
rogue.whistler is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
As is often the case, the culprits are stray spaces introduced at the ends of lines. And because of the nature of the token list, which gets added to the tabular at the end of the process, all those stray spaces get added before the token list gets dumped, meaning, all are added as leading padding to cell (1,1).
In this case, the fix not only meant adding some % at line ends inside your macro definitions, but it also meant incorporating ignorespaces into the definition of topic, since every time you invoked topic, stray spaces were introduced as part of your input stream, as well.
I also generalized mytabular to take the formatting as an argument.
documentclassarticle
usepackage[T1]fontenc
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2%
addtabtoks\%
ignorespaces
newenvironmentmytabular[1]%
resettabtoks
noindent
begintabular#1%
%
printtabtoks
endtabular
makeatother
begindocument
beginmytabularllrrl
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument

Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
add a comment |
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
);
);
rogue.whistler is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488954%2fextra-space-in-cells-when-using-token-lists-to-build-tabular-content%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As is often the case, the culprits are stray spaces introduced at the ends of lines. And because of the nature of the token list, which gets added to the tabular at the end of the process, all those stray spaces get added before the token list gets dumped, meaning, all are added as leading padding to cell (1,1).
In this case, the fix not only meant adding some % at line ends inside your macro definitions, but it also meant incorporating ignorespaces into the definition of topic, since every time you invoked topic, stray spaces were introduced as part of your input stream, as well.
I also generalized mytabular to take the formatting as an argument.
documentclassarticle
usepackage[T1]fontenc
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2%
addtabtoks\%
ignorespaces
newenvironmentmytabular[1]%
resettabtoks
noindent
begintabular#1%
%
printtabtoks
endtabular
makeatother
begindocument
beginmytabularllrrl
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument

Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
add a comment |
As is often the case, the culprits are stray spaces introduced at the ends of lines. And because of the nature of the token list, which gets added to the tabular at the end of the process, all those stray spaces get added before the token list gets dumped, meaning, all are added as leading padding to cell (1,1).
In this case, the fix not only meant adding some % at line ends inside your macro definitions, but it also meant incorporating ignorespaces into the definition of topic, since every time you invoked topic, stray spaces were introduced as part of your input stream, as well.
I also generalized mytabular to take the formatting as an argument.
documentclassarticle
usepackage[T1]fontenc
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2%
addtabtoks\%
ignorespaces
newenvironmentmytabular[1]%
resettabtoks
noindent
begintabular#1%
%
printtabtoks
endtabular
makeatother
begindocument
beginmytabularllrrl
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument

Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
add a comment |
As is often the case, the culprits are stray spaces introduced at the ends of lines. And because of the nature of the token list, which gets added to the tabular at the end of the process, all those stray spaces get added before the token list gets dumped, meaning, all are added as leading padding to cell (1,1).
In this case, the fix not only meant adding some % at line ends inside your macro definitions, but it also meant incorporating ignorespaces into the definition of topic, since every time you invoked topic, stray spaces were introduced as part of your input stream, as well.
I also generalized mytabular to take the formatting as an argument.
documentclassarticle
usepackage[T1]fontenc
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2%
addtabtoks\%
ignorespaces
newenvironmentmytabular[1]%
resettabtoks
noindent
begintabular#1%
%
printtabtoks
endtabular
makeatother
begindocument
beginmytabularllrrl
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument

As is often the case, the culprits are stray spaces introduced at the ends of lines. And because of the nature of the token list, which gets added to the tabular at the end of the process, all those stray spaces get added before the token list gets dumped, meaning, all are added as leading padding to cell (1,1).
In this case, the fix not only meant adding some % at line ends inside your macro definitions, but it also meant incorporating ignorespaces into the definition of topic, since every time you invoked topic, stray spaces were introduced as part of your input stream, as well.
I also generalized mytabular to take the formatting as an argument.
documentclassarticle
usepackage[T1]fontenc
makeatletter
newtoks@tabtoks
newcommandaddtabtoks[1]global@tabtoksexpandafterthe@tabtoks#1
newcommandeaddtabtoks[1]edefmytmp#1expandafteraddtabtoksexpandaftermytmp
newcommand*resettabtoksglobal@tabtoks
newcommand*printtabtoksthe@tabtoks
newcommandtopic[2]%
eaddtabtoksCol 1 & Col 2 & Col 3 & #1 & #2%
addtabtoks\%
ignorespaces
newenvironmentmytabular[1]%
resettabtoks
noindent
begintabular#1%
%
printtabtoks
endtabular
makeatother
begindocument
beginmytabularllrrl
topic1.1LaTeX
topic1.2causes
topic1.3me
topic1.4lots
topic1.5of
topic1.6frustration
endmytabular
enddocument

edited May 3 at 14:08
answered May 3 at 13:56
Steven B. SegletesSteven B. Segletes
164k9209424
164k9209424
Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
add a comment |
Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
Thank you. Your specific suggestions solved my MWE, but not my original problem exactly. However, they led me in the right direction to find other stray spaces and deal with them accordingly. (I have other O/T reasons for not including the tabular formatting as an argument).
– rogue.whistler
May 3 at 14:15
1
1
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
@rogue.whistler Happy to help.Welcome to the site.
– Steven B. Segletes
May 3 at 14:16
add a comment |
rogue.whistler is a new contributor. Be nice, and check out our Code of Conduct.
rogue.whistler is a new contributor. Be nice, and check out our Code of Conduct.
rogue.whistler is a new contributor. Be nice, and check out our Code of Conduct.
rogue.whistler is a new contributor. Be nice, and check out our Code of Conduct.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f488954%2fextra-space-in-cells-when-using-token-lists-to-build-tabular-content%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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