Is there a table package which automatically calculates the needed number of columns?











up vote
2
down vote

favorite
1












Is there a table package which automatically calculates the needed number of columns? Take for example this:



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}


deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|*{100}{c}} % Just choose 100, practically enough columns... but this ist not very elegant
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}


I can just choose 101 row numbers (large enough for pracical purposes), but this doesn't seem to be the correct way to do this. So is there any package which doesn't require the number of columns for this example?










share|improve this question




















  • 1




    that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
    – David Carlisle
    Mar 12 '17 at 16:06















up vote
2
down vote

favorite
1












Is there a table package which automatically calculates the needed number of columns? Take for example this:



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}


deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|*{100}{c}} % Just choose 100, practically enough columns... but this ist not very elegant
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}


I can just choose 101 row numbers (large enough for pracical purposes), but this doesn't seem to be the correct way to do this. So is there any package which doesn't require the number of columns for this example?










share|improve this question




















  • 1




    that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
    – David Carlisle
    Mar 12 '17 at 16:06













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





Is there a table package which automatically calculates the needed number of columns? Take for example this:



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}


deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|*{100}{c}} % Just choose 100, practically enough columns... but this ist not very elegant
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}


I can just choose 101 row numbers (large enough for pracical purposes), but this doesn't seem to be the correct way to do this. So is there any package which doesn't require the number of columns for this example?










share|improve this question















Is there a table package which automatically calculates the needed number of columns? Take for example this:



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}


deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|*{100}{c}} % Just choose 100, practically enough columns... but this ist not very elegant
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}


I can just choose 101 row numbers (large enough for pracical purposes), but this doesn't seem to be the correct way to do this. So is there any package which doesn't require the number of columns for this example?







tables xint






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 23:59









Andrew

29.4k34178




29.4k34178










asked Mar 12 '17 at 16:05









student

12.2k2396173




12.2k2396173








  • 1




    that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
    – David Carlisle
    Mar 12 '17 at 16:06














  • 1




    that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
    – David Carlisle
    Mar 12 '17 at 16:06








1




1




that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
– David Carlisle
Mar 12 '17 at 16:06




that is exactly what amsmath does to avoid needing to specify the number of columns in matrix
– David Carlisle
Mar 12 '17 at 16:06










1 Answer
1






active

oldest

votes

















up vote
4
down vote



accepted










using some large number in a * column repeat isn't so bad, it's how amsmath matrix avoids the need to specify columns, however if you want to access TeX's primitive feature of a && meaning to repeat all following column specifications as often as needed then you can do something like



enter image description here



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}

makeatletter
newcolumntype{?}{!{d@llarend&span@gobbletwo}}
makeatother

deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|?c}
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}





share|improve this answer





















  • Where do you use &&?
    – Werner
    Mar 12 '17 at 17:12






  • 1




    @Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
    – David Carlisle
    Mar 12 '17 at 17:13












  • this deserves some LaTeX user interface!
    – jfbu
    Nov 20 at 9:11










  • @jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
    – David Carlisle
    Nov 20 at 9:22










  • I would were it not for the @ :)
    – jfbu
    Nov 20 at 11:10











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',
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%2f358105%2fis-there-a-table-package-which-automatically-calculates-the-needed-number-of-col%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








up vote
4
down vote



accepted










using some large number in a * column repeat isn't so bad, it's how amsmath matrix avoids the need to specify columns, however if you want to access TeX's primitive feature of a && meaning to repeat all following column specifications as often as needed then you can do something like



enter image description here



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}

makeatletter
newcolumntype{?}{!{d@llarend&span@gobbletwo}}
makeatother

deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|?c}
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}





share|improve this answer





















  • Where do you use &&?
    – Werner
    Mar 12 '17 at 17:12






  • 1




    @Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
    – David Carlisle
    Mar 12 '17 at 17:13












  • this deserves some LaTeX user interface!
    – jfbu
    Nov 20 at 9:11










  • @jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
    – David Carlisle
    Nov 20 at 9:22










  • I would were it not for the @ :)
    – jfbu
    Nov 20 at 11:10















up vote
4
down vote



accepted










using some large number in a * column repeat isn't so bad, it's how amsmath matrix avoids the need to specify columns, however if you want to access TeX's primitive feature of a && meaning to repeat all following column specifications as often as needed then you can do something like



enter image description here



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}

makeatletter
newcolumntype{?}{!{d@llarend&span@gobbletwo}}
makeatother

deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|?c}
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}





share|improve this answer





















  • Where do you use &&?
    – Werner
    Mar 12 '17 at 17:12






  • 1




    @Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
    – David Carlisle
    Mar 12 '17 at 17:13












  • this deserves some LaTeX user interface!
    – jfbu
    Nov 20 at 9:11










  • @jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
    – David Carlisle
    Nov 20 at 9:22










  • I would were it not for the @ :)
    – jfbu
    Nov 20 at 11:10













up vote
4
down vote



accepted







up vote
4
down vote



accepted






using some large number in a * column repeat isn't so bad, it's how amsmath matrix avoids the need to specify columns, however if you want to access TeX's primitive feature of a && meaning to repeat all following column specifications as often as needed then you can do something like



enter image description here



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}

makeatletter
newcolumntype{?}{!{d@llarend&span@gobbletwo}}
makeatother

deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|?c}
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}





share|improve this answer












using some large number in a * column repeat isn't so bad, it's how amsmath matrix avoids the need to specify columns, however if you want to access TeX's primitive feature of a && meaning to repeat all following column specifications as often as needed then you can do something like



enter image description here



documentclass{article}

usepackage{pgf}
usepackage{siunitx}
usepackage{xinttools}

begin{document}

makeatletter
newcolumntype{?}{!{d@llarend&span@gobbletwo}}
makeatother

deflist{0,0.5,1,2.5,3,4.5,8}
deff(#1){#1^2}
defpf(#1){pgfmathparse{f(#1)}num[round-precision=1,round-mode=places]{pgfmathresult}}


begin{tabular}{l|?c}
$x$ & xintFor #1 in list do { & $#1$} \hline
$f(x)$ & xintFor #1 in list do { & $pf(#1)$}
end{tabular}

end{document}






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 12 '17 at 17:08









David Carlisle

477k3811061841




477k3811061841












  • Where do you use &&?
    – Werner
    Mar 12 '17 at 17:12






  • 1




    @Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
    – David Carlisle
    Mar 12 '17 at 17:13












  • this deserves some LaTeX user interface!
    – jfbu
    Nov 20 at 9:11










  • @jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
    – David Carlisle
    Nov 20 at 9:22










  • I would were it not for the @ :)
    – jfbu
    Nov 20 at 11:10


















  • Where do you use &&?
    – Werner
    Mar 12 '17 at 17:12






  • 1




    @Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
    – David Carlisle
    Mar 12 '17 at 17:13












  • this deserves some LaTeX user interface!
    – jfbu
    Nov 20 at 9:11










  • @jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
    – David Carlisle
    Nov 20 at 9:22










  • I would were it not for the @ :)
    – jfbu
    Nov 20 at 11:10
















Where do you use &&?
– Werner
Mar 12 '17 at 17:12




Where do you use &&?
– Werner
Mar 12 '17 at 17:12




1




1




@Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
– David Carlisle
Mar 12 '17 at 17:13






@Werner the array package added one and I dropped in another, and the span@gobbletwo made them come next to each other.
– David Carlisle
Mar 12 '17 at 17:13














this deserves some LaTeX user interface!
– jfbu
Nov 20 at 9:11




this deserves some LaTeX user interface!
– jfbu
Nov 20 at 9:11












@jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
– David Carlisle
Nov 20 at 9:22




@jfbu I'm upset that you don't consider my &span@gobbletwo as a high level well designed and intuitive latex user interface :(
– David Carlisle
Nov 20 at 9:22












I would were it not for the @ :)
– jfbu
Nov 20 at 11:10




I would were it not for the @ :)
– jfbu
Nov 20 at 11:10


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f358105%2fis-there-a-table-package-which-automatically-calculates-the-needed-number-of-col%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

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents