Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have quite a lot of lists of numbers I need to put into my document. I am not sure how best to typeset them. Inspired by reading Add \midrule Every 5 Lines Automatically the other day, I sort of wondered whether it's possible to use a tabular environment and automatically generate newlines every n numbers, where I could vary n - right now I have just manually created a table, but I want to change n and now I have to go through and move all the \\ and insert extra &... I have absolutely no idea where to begin with this idea though! Here's my current table:

\documentclass[12pt, a4paper, oneside, fleqn]{report}
\usepackage{geometry}
\geometry{
  top=2.5cm,
  left=3.5cm,
  bottom=2.5cm,
  right=2.5cm,
  includehead,
  headheight=28pt,
  headsep=18pt,
  showframe,
}

\usepackage{siunitx}
\usepackage{array,booktabs}


\begin{document}


  \begin{tabular}{ @{} *{10}{S[table-format=4]} @{} } 
  16&   38&  49&  51&  55&  57&  59&  61&  63&  66  \\
  70&   72&  74&  79&  81&  83&  85&  87&  89&  92  \\
  95&   97&  99& 101& 104& 106& 109& 111& 113& 116 \\
  119& 122& 125& 128& 131& 133& 135& 138& 141& 144  \\
  146& 148& 151& 154& 157& 159& 161& 163& 167& 170 \\
  173& 176& 179& 180& 185& 187& 193& 199& 205& 207 \\
  210& 212& 214& 217& 219& 222& 224& 226& 230& 232 \\
  236& 239& 242& 243& 246& 249& 252& 254& 260& 262 \\
  265& 267& 269& 275& 280& 282& 294& 296& 299& 303 \\
  306& 323& 327& 329& 335& 345& 347& 350& 354& 356 \\
  360& 366& 371& 373& 375& 377& 379& 381& 383& 386 \\
  389& 398& 401& 404& 407& 410& 414& 416& 426& 428 \\
  432& 434& 439& 445& 457& 515& 546& 552& 559& 566 \\
  571& 573& 646& 662& 668& 756& 867& 906& 921& 1027 \\
  1046& 1121& 1133& 1191& 1194& 1271& 1479& 1509& 1513& 1521 \\
  1536& 1574& 1579& 1585& 1587& 1626& 1639& 1643& 1652& 1658 \\
  1671& 1786& 1805& 1884& 1991& 2019& 2094& 2119& 2213& 2239 \\
  2245& 2271& 2321& 2398& 2701& 2741& 2819& 2889& 2907& 2910 \\
  2919& 2939& 2944& 2948& 2951& 2958& 2977& 2985& 2988& 2991 \\
  2993& 3002& 3008& 3014& 3027& 3029& 3036& 3047& 3049& 3053 \\
  3058& 3064& 3069& 3087& 3093& 3098& 3105& 3107& 3110& 3127 \\
  3136& 3151& 3160& 3165& 3168& 3175& 3178& 3207& 3228& 3244 \\
  3248& 3252& 3256& 3263& 3281& 3303& 3309& 3312& 3322& 3339 \\
  3375& 3378& 3411& 3438& 3440& 3442& 3444& 3446& 3448& 3450 \\
  3452& 3454& 3458& 3467& 3476& 3484& 3491& 3497& 3499& 3504 \\
  3506& 3509& 3518& 3522& 3527& 3540& 3555& 3575& 3577& 3580 \\
  3582& 3586& 3589& 3599& 3653& 3658& 3661& 3943& 4032& 5130 \\
  5368& 5371& 5379& 5381& 5383& 5397& 5399& 5401& 5403& 5405 \\
  5455& 5480& 5483& 5485& 5492& 5502& 5507& 5509& 5517& 5558 \\
  5988& 5992& 5994& 6003& 6350& 6463& 6601& 6962& 6980& 6982 \\
  6985& 6987& 6989& 6991& 6993& 6995& 6997& 7267& 7269& 7424 \\
  7426& 7428& 7885& 8007
\end{tabular}  

\end{document}

I am not even sure this is the best way to display a list of numbers - does it even look OK? I think it looks marginally better than the randomly spaced list I had before I inserted the tabular, and a lot better than the comma separated list I tried.

share|improve this question
    
@Mico thanks for that edit - I didn't know you could do that! –  FionaSmith Jun 6 at 8:36

4 Answers 4

up vote 5 down vote accepted

enter image description here

\documentclass[12pt, a4paper, oneside, fleqn]{report}
\usepackage{geometry}
\geometry{
  top=2.5cm,
  left=3.5cm,
  bottom=2.5cm,
  right=2.5cm,
  includehead,
  headheight=28pt,
  headsep=18pt,
  showframe,
}

\def\mylist#1 {\ifx!#1\else\makebox[4em][r]{#1} \expandafter\mylist\fi}


\begin{document}


\begin{flushleft}
  \mylist
  16   38  49  51  55  57  59  61  63  66  
  70   72  74  79  81  83  85  87  89  92  
  95   97  99 101 104 106 109 111 113 116 
  119 122 125 128 131 133 135 138 141 144  
  146 148 151 154 157 159 161 163 167 170 
  173 176 179 180 185 187 193 199 205 207 
  210 212 214 217 219 222 224 226 230 232 
  236 239 242 243 246 249 252 254 260 262 
  265 267 269 275 280 282 294 296 299 303 
  306 323 327 329 335 345 347 350 354 356 
  360 366 371 373 375 377 379 381 383 386 
  389 398 401 404 407 410 414 416 426 428 
  432 434 439 445 457 515 546 552 559 566 
  571 573 646 662 668 756 867 906 921 1027 
  1046 1121 1133 1191 1194 1271 1479 1509 1513 1521 
  1536 1574 1579 1585 1587 1626 1639 1643 1652 1658 
  1671 1786 1805 1884 1991 2019 2094 2119 2213 2239 
  2245 2271 2321 2398 2701 2741 2819 2889 2907 2910 
  2919 2939 2944 2948 2951 2958 2977 2985 2988 2991 
  2993 3002 3008 3014 3027 3029 3036 3047 3049 3053 
  3058 3064 3069 3087 3093 3098 3105 3107 3110 3127 
  3136 3151 3160 3165 3168 3175 3178 3207 3228 3244 
  3248 3252 3256 3263 3281 3303 3309 3312 3322 3339 
  3375 3378 3411 3438 3440 3442 3444 3446 3448 3450 
  3452 3454 3458 3467 3476 3484 3491 3497 3499 3504 
  3506 3509 3518 3522 3527 3540 3555 3575 3577 3580 
  3582 3586 3589 3599 3653 3658 3661 3943 4032 5130 
  5368 5371 5379 5381 5383 5397 5399 5401 5403 5405 
  5455 5480 5483 5485 5492 5502 5507 5509 5517 5558 
  5988 5992 5994 6003 6350 6463 6601 6962 6980 6982 
  6985 6987 6989 6991 6993 6995 6997 7267 7269 7424 
  7426 7428 7885 8007 !
\end{flushleft}

\end{document}
share|improve this answer
    
Ah! Clever! This one breaks nicely if the table does not fit in one page. –  Bordaigorl Jun 5 at 23:23
    
Instead of 4em you could put it in “parts of \textwidth” so the “table” fills the whole line, e.g., something like \makebox[.125\linewidth][r]{#1}. –  Manuel Jun 6 at 0:39
    
@Manuel a bit less, there is a word space between each (but you could replace that by \linebreak[0] to allow breaking without adding space –  David Carlisle Jun 6 at 7:28
    
I am taking my time to decide which answer to select because they are all good! I really like this solution because it involves the least code and the least reformatting of my lists of numbers. The one thing I don't like so much is the "flushleft" aspect of it. The other solutions allow centering of the tabular, which looks quite nice. That said, it's possible to play with the width of the box so the flushleft is barely noticeable. I don't understand the above comment re \linebreak[0] - could you explain? –  FionaSmith Jun 6 at 10:26
    
@FionaSmith There is a space between each pair of numbers, so the text can be breaked between lines. However, if you want to control more the exact width of the “table” it's better not to have those spaces and you can just substitute them with \linebreak[0]. By the way, David, is there a problem with center environment instead of flushleft? –  Manuel Jun 6 at 10:35

If you're sure the table will fit in one page, then this should do:

\documentclass[12pt, a4paper, oneside, fleqn]{report}
\usepackage{geometry}
\geometry{
  top=2.5cm,
  left=3.5cm,
  bottom=2.5cm,
  right=2.5cm,
  includehead,
  headheight=28pt,
  headsep=18pt,
  showframe,
}

\usepackage{xparse}
\usepackage{siunitx}
\usepackage{array,booktabs}

\ExplSyntaxOn
\NewDocumentCommand{\numberlist}{mm}
 {% #1 = number of cols, #2 = number list
  \fiona_number_list:nn { #1 } { #2 }
 }

\seq_new:N \l_fiona_items_seq
\tl_new:N \l_fiona_table_body_tl
\int_new:N \l_fiona_column_index_int

\cs_new_protected:Npn \fiona_number_list:nn #1 #2
 {
  \seq_set_split:Nnn \l_fiona_items_seq { , } { #2 }
  \int_zero:N \l_fiona_column_index_int
  \tl_clear:N \l_fiona_table_body_tl
  \seq_map_inline:Nn \l_fiona_items_seq
   {
    \int_incr:N \l_fiona_column_index_int
    \int_compare:nTF { \l_fiona_column_index_int == #1 }
     {
      \tl_put_right:Nn \l_fiona_table_body_tl { \num{##1} \\ }
      \int_zero:N \l_fiona_column_index_int
     }
     {
      \tl_put_right:Nn \l_fiona_table_body_tl { \num{##1} & }
     }
   }
   \int_compare:nF { \l_fiona_column_index_int == 0 }
    {
     \tl_put_right:Nn \l_fiona_table_body_tl { \\ }
    }
  \begin{tabular}{@{} *{#1}{r} @{}}
  \l_fiona_table_body_tl
  \end{tabular}
}
\ExplSyntaxOff

\begin{document}

\numberlist{10}{
  16,   38,  49,  51,  55,  57,  59,  61,  63,  66,
  70,   72,  74,  79,  81,  83,  85,  87,  89,  92,
  95,   97,  99, 101, 104, 106, 109, 111, 113, 116,
  119, 122, 125, 128, 131, 133, 135, 138, 141, 144,
  146, 148, 151, 154, 157, 159, 161, 163, 167, 170,
  173, 176, 179, 180, 185, 187, 193, 199, 205, 207,
  210, 212, 214, 217, 219, 222, 224, 226, 230, 232,
  236, 239, 242, 243, 246, 249, 252, 254, 260, 262,
  265, 267, 269, 275, 280, 282, 294, 296, 299, 303,
  306, 323, 327, 329, 335, 345, 347, 350, 354, 356,
  360, 366, 371, 373, 375, 377, 379, 381, 383, 386,
  389, 398, 401, 404, 407, 410, 414, 416, 426, 428,
  432, 434, 439, 445, 457, 515, 546, 552, 559, 566,
  571, 573, 646, 662, 668, 756, 867, 906, 921, 1027,
  1046, 1121, 1133, 1191, 1194, 1271, 1479, 1509, 1513, 1521,
  1536, 1574, 1579, 1585, 1587, 1626, 1639, 1643, 1652, 1658,
  1671, 1786, 1805, 1884, 1991, 2019, 2094, 2119, 2213, 2239,
  2245, 2271, 2321, 2398, 2701, 2741, 2819, 2889, 2907, 2910,
  2919, 2939, 2944, 2948, 2951, 2958, 2977, 2985, 2988, 2991,
  2993, 3002, 3008, 3014, 3027, 3029, 3036, 3047, 3049, 3053,
  3058, 3064, 3069, 3087, 3093, 3098, 3105, 3107, 3110, 3127,
  3136, 3151, 3160, 3165, 3168, 3175, 3178, 3207, 3228, 3244,
  3248, 3252, 3256, 3263, 3281, 3303, 3309, 3312, 3322, 3339,
  3375, 3378, 3411, 3438, 3440, 3442, 3444, 3446, 3448, 3450,
  3452, 3454, 3458, 3467, 3476, 3484, 3491, 3497, 3499, 3504,
  3506, 3509, 3518, 3522, 3527, 3540, 3555, 3575, 3577, 3580,
  3582, 3586, 3589, 3599, 3653, 3658, 3661, 3943, 4032, 5130,
  5368, 5371, 5379, 5381, 5383, 5397, 5399, 5401, 5403, 5405,
  5455, 5480, 5483, 5485, 5492, 5502, 5507, 5509, 5517, 5558,
  5988, 5992, 5994, 6003, 6350, 6463, 6601, 6962, 6980, 6982,
  6985, 6987, 6989, 6991, 6993, 6995, 6997, 7267, 7269, 7424,
  7426, 7428, 7885, 8007
}

\end{document}

enter image description here

This is the output when \numberlist{12}{...} is called (I also added a center environment)

enter image description here

share|improve this answer
    
I am taking my time to select an answer because they are all good. I like this answer because the ability to centre the tabular is very nice and also because it is easy to change the number of columns on-the-fly. I like @DavidCarlisle's answer because I don't have to add commas and it's only one line of code. Could you explain why I can't use the S format in the tablular? Doesn't matter in this instance, but interested to know. –  FionaSmith Jun 6 at 10:33
    
Also, I didn't think tabular created a float - yet this code generates a table that starts on a new page and I can't see anything explicitly doing that. Is it tabular itself? –  FionaSmith Jun 6 at 10:34
    
Final question: this answer is very similar to @Bordaigorl's solution but his seems a touch more concise ;-) - is there any advantage you can see to use your code over his? –  FionaSmith Jun 6 at 10:47

An option using pgfplotstable

% arara: pdflatex
\documentclass{article}
\usepackage{pgfplotstable}

\begin{document}

\pgfplotstableread[
  col sep=comma,
    ]{%
  16,   38,  49,  51,  55,  57,  59,  61,  63,  66,
  70,   72,  74,  79,  81,  83,  85,  87,  89,  92,
  95,   97,  99, 101, 104, 106, 109, 111, 113, 116,
  119, 122, 125, 128, 131, 133, 135, 138, 141, 144,
  146, 148, 151, 154, 157, 159, 161, 163, 167, 170,
  173, 176, 179, 180, 185, 187, 193, 199, 205, 207,
  210, 212, 214, 217, 219, 222, 224, 226, 230, 232,
  236, 239, 242, 243, 246, 249, 252, 254, 260, 262,
  265, 267, 269, 275, 280, 282, 294, 296, 299, 303,
  306, 323, 327, 329, 335, 345, 347, 350, 354, 356,
  360, 366, 371, 373, 375, 377, 379, 381, 383, 386,
  389, 398, 401, 404, 407, 410, 414, 416, 426, 428,
  432, 434, 439, 445, 457, 515, 546, 552, 559, 566,
  571, 573, 646, 662, 668, 756, 867, 906, 921, 1027,
  1046, 1121, 1133, 1191, 1194, 1271, 1479, 1509, 1513, 1521,
  1536, 1574, 1579, 1585, 1587, 1626, 1639, 1643, 1652, 1658,
  1671, 1786, 1805, 1884, 1991, 2019, 2094, 2119, 2213, 2239,
  2245, 2271, 2321, 2398, 2701, 2741, 2819, 2889, 2907, 2910,
  2919, 2939, 2944, 2948, 2951, 2958, 2977, 2985, 2988, 2991,
  2993, 3002, 3008, 3014, 3027, 3029, 3036, 3047, 3049, 3053,
  3058, 3064, 3069, 3087, 3093, 3098, 3105, 3107, 3110, 3127,
  3136, 3151, 3160, 3165, 3168, 3175, 3178, 3207, 3228, 3244,
  3248, 3252, 3256, 3263, 3281, 3303, 3309, 3312, 3322, 3339,
  3375, 3378, 3411, 3438, 3440, 3442, 3444, 3446, 3448, 3450,
  3452, 3454, 3458, 3467, 3476, 3484, 3491, 3497, 3499, 3504,
  3506, 3509, 3518, 3522, 3527, 3540, 3555, 3575, 3577, 3580,
  3582, 3586, 3589, 3599, 3653, 3658, 3661, 3943, 4032, 5130,
  5368, 5371, 5379, 5381, 5383, 5397, 5399, 5401, 5403, 5405,
  5455, 5480, 5483, 5485, 5492, 5502, 5507, 5509, 5517, 5558,
  5988, 5992, 5994, 6003, 6350, 6463, 6601, 6962, 6980, 6982,
  6985, 6987, 6989, 6991, 6993, 6995, 6997, 7267, 7269, 7424,
  7426, 7428, 7885, 8007, , , , , , , 
}{\fionasData}

\pgfplotstabletypeset[every head row/.style={output empty row}]{\fionasData}

\end{document}

This could also be combined with longtable by simply using

\pgfplotstabletypeset[
    every head row/.style={output empty row},
    begin table=\begin{longtable},
  end table=\end{longtable},
]{\fionasData}

Here's a complete MWE

% arara: pdflatex
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{longtable}
\begin{document}

\pgfplotstableread[
  col sep=comma,
    ]{%
  16,   38,  49,  51,  55,  57,  59,  61,  63,  66,
  70,   72,  74,  79,  81,  83,  85,  87,  89,  92,
  95,   97,  99, 101, 104, 106, 109, 111, 113, 116,
  119, 122, 125, 128, 131, 133, 135, 138, 141, 144,
  146, 148, 151, 154, 157, 159, 161, 163, 167, 170,
  173, 176, 179, 180, 185, 187, 193, 199, 205, 207,
  210, 212, 214, 217, 219, 222, 224, 226, 230, 232,
  236, 239, 242, 243, 246, 249, 252, 254, 260, 262,
  265, 267, 269, 275, 280, 282, 294, 296, 299, 303,
  306, 323, 327, 329, 335, 345, 347, 350, 354, 356,
  360, 366, 371, 373, 375, 377, 379, 381, 383, 386,
  389, 398, 401, 404, 407, 410, 414, 416, 426, 428,
  432, 434, 439, 445, 457, 515, 546, 552, 559, 566,
  571, 573, 646, 662, 668, 756, 867, 906, 921, 1027,
  1046, 1121, 1133, 1191, 1194, 1271, 1479, 1509, 1513, 1521,
  1536, 1574, 1579, 1585, 1587, 1626, 1639, 1643, 1652, 1658,
  1671, 1786, 1805, 1884, 1991, 2019, 2094, 2119, 2213, 2239,
  2245, 2271, 2321, 2398, 2701, 2741, 2819, 2889, 2907, 2910,
  2919, 2939, 2944, 2948, 2951, 2958, 2977, 2985, 2988, 2991,
  2993, 3002, 3008, 3014, 3027, 3029, 3036, 3047, 3049, 3053,
  3058, 3064, 3069, 3087, 3093, 3098, 3105, 3107, 3110, 3127,
  3136, 3151, 3160, 3165, 3168, 3175, 3178, 3207, 3228, 3244,
  3248, 3252, 3256, 3263, 3281, 3303, 3309, 3312, 3322, 3339,
  3375, 3378, 3411, 3438, 3440, 3442, 3444, 3446, 3448, 3450,
  3452, 3454, 3458, 3467, 3476, 3484, 3491, 3497, 3499, 3504,
  3506, 3509, 3518, 3522, 3527, 3540, 3555, 3575, 3577, 3580,
  3582, 3586, 3589, 3599, 3653, 3658, 3661, 3943, 4032, 5130,
  5368, 5371, 5379, 5381, 5383, 5397, 5399, 5401, 5403, 5405,
  5455, 5480, 5483, 5485, 5492, 5502, 5507, 5509, 5517, 5558,
  5988, 5992, 5994, 6003, 6350, 6463, 6601, 6962, 6980, 6982,
  6985, 6987, 6989, 6991, 6993, 6995, 6997, 7267, 7269, 7424,
    16,   38,  49,  51,  55,  57,  59,  61,  63,  66,
  70,   72,  74,  79,  81,  83,  85,  87,  89,  92,
  95,   97,  99, 101, 104, 106, 109, 111, 113, 116,
  119, 122, 125, 128, 131, 133, 135, 138, 141, 144,
  146, 148, 151, 154, 157, 159, 161, 163, 167, 170,
  173, 176, 179, 180, 185, 187, 193, 199, 205, 207,
  210, 212, 214, 217, 219, 222, 224, 226, 230, 232,
  236, 239, 242, 243, 246, 249, 252, 254, 260, 262,
  265, 267, 269, 275, 280, 282, 294, 296, 299, 303,
  306, 323, 327, 329, 335, 345, 347, 350, 354, 356,
  360, 366, 371, 373, 375, 377, 379, 381, 383, 386,
  389, 398, 401, 404, 407, 410, 414, 416, 426, 428,
  432, 434, 439, 445, 457, 515, 546, 552, 559, 566,
  571, 573, 646, 662, 668, 756, 867, 906, 921, 1027,
  1046, 1121, 1133, 1191, 1194, 1271, 1479, 1509, 1513, 1521,
  1536, 1574, 1579, 1585, 1587, 1626, 1639, 1643, 1652, 1658,
  1671, 1786, 1805, 1884, 1991, 2019, 2094, 2119, 2213, 2239,
  2245, 2271, 2321, 2398, 2701, 2741, 2819, 2889, 2907, 2910,
  2919, 2939, 2944, 2948, 2951, 2958, 2977, 2985, 2988, 2991,
  2993, 3002, 3008, 3014, 3027, 3029, 3036, 3047, 3049, 3053,
  3058, 3064, 3069, 3087, 3093, 3098, 3105, 3107, 3110, 3127,
  3136, 3151, 3160, 3165, 3168, 3175, 3178, 3207, 3228, 3244,
  3248, 3252, 3256, 3263, 3281, 3303, 3309, 3312, 3322, 3339,
  3375, 3378, 3411, 3438, 3440, 3442, 3444, 3446, 3448, 3450,
  3452, 3454, 3458, 3467, 3476, 3484, 3491, 3497, 3499, 3504,
  3506, 3509, 3518, 3522, 3527, 3540, 3555, 3575, 3577, 3580,
  3582, 3586, 3589, 3599, 3653, 3658, 3661, 3943, 4032, 5130,
  5368, 5371, 5379, 5381, 5383, 5397, 5399, 5401, 5403, 5405,
  5455, 5480, 5483, 5485, 5492, 5502, 5507, 5509, 5517, 5558,
  5988, 5992, 5994, 6003, 6350, 6463, 6601, 6962, 6980, 6982,
  6985, 6987, 6989, 6991, 6993, 6995, 6997, 7267, 7269, 7424,
  7426, 7428, 7885, 8007, , , , , , , 
}{\fionasData}

\pgfplotstabletypeset[
    every head row/.style={output empty row},
    begin table=\begin{longtable},
  end table=\end{longtable},
]{\fionasData}

\end{document}
share|improve this answer
    
ah - my option assumes that the numbers are nicely arranged with the same numbers per row. perhaps it will help others as a starting point... –  cmhughes Jun 5 at 23:33
    
    
thanks for taking the time to come up with another solution for me. Sadly, I think the issue you identified yourself prevents me from accepting it as I am particularly after something that allows me to adjust the line contents on the fly. –  FionaSmith Jun 6 at 10:46

A LaTeX solution

\documentclass[12pt, a4paper, oneside, fleqn]{report}
\usepackage{geometry}
\geometry{
  top=2.5cm,
  left=3.5cm,
  bottom=2.5cm,
  right=2.5cm,
  includehead,
  headheight=28pt,
  headsep=18pt,
  showframe,
}

\usepackage{array,booktabs}

\makeatletter
\newcount\tabnums@num
\newcommand{\tabnums}[2]{
    \tabnums@num=0
    \gdef\tabnums@body{}
    \@for\@i:={#2}\do{%
        \advance\tabnums@num by 1\relax%
        \ifnum\tabnums@num=#1\relax%
            \xdef\tabnums@body{\tabnums@body\@i \cr}%
            \tabnums@num=0\relax%
        \else%
            \xdef\tabnums@body{\tabnums@body\@i &}%
        \fi%
    }%
    \begin{tabular}{@{} *{#1}{r} @{}}
    \tabnums@body\relax
    \end{tabular}
}
\makeatother

\begin{document}
\tabnums{12}{
16, 38, 49, 51, 55, 57, 59, 61, 63, 66, 70, 72, 74, 79, 81, 83, 85, 87, 89, 92,
95, 97, 99, 101, 104, 106, 109, 111, 113, 116, 
119, 122, 125, 128, 131, 133, 135, 138, 141, 144, 
146, 148, 151, 154, 157, 159, 161, 163, 167, 170, 
173, 176, 179, 180, 185, 187, 193, 199, 205, 207, 
210, 212, 214, 217, 219, 222, 224, 226, 230, 232, 
236, 239, 242, 243, 246, 249, 252, 254, 260, 262, 
265, 267, 269, 275, 280, 282, 294, 296, 299, 303, 
306, 323, 327, 329, 335, 345, 347, 350, 354, 356, 
360, 366, 371, 373, 375, 377, 379, 381, 383, 386, 
389, 398, 401, 404, 407, 410, 414, 416, 426, 428, 
432, 434, 439, 445, 457, 515, 546, 552, 559, 566, 
571, 573, 646, 662, 668, 756, 867, 906, 921, 1027, 
1046, 1121, 1133, 1191, 1194, 1271, 1479, 1509, 1513, 1521, 
1536, 1574, 1579, 1585, 1587, 1626, 1639, 1643, 1652, 1658, 
1671, 1786, 1805, 1884, 1991, 2019, 2094, 2119, 2213, 2239, 
2245, 2271, 2321, 2398, 2701, 2741, 2819, 2889, 2907, 2910, 
2919, 2939, 2944, 2948, 2951, 2958, 2977, 2985, 2988, 2991, 
2993, 3002, 3008, 3014, 3027, 3029, 3036, 3047, 3049, 3053, 
3058, 3064, 3069, 3087, 3093, 3098, 3105, 3107, 3110, 3127, 
3136, 3151, 3160, 3165, 3168, 3175, 3178, 3207, 3228, 3244, 
3248, 3252, 3256, 3263, 3281, 3303, 3309, 3312, 3322, 3339, 
3375, 3378, 3411, 3438, 3440, 3442, 3444, 3446, 3448, 3450, 
3452, 3454, 3458, 3467, 3476, 3484, 3491, 3497, 3499, 3504, 
3506, 3509, 3518, 3522, 3527, 3540, 3555, 3575, 3577, 3580, 
3582, 3586, 3589, 3599, 3653, 3658, 3661, 3943, 4032, 5130, 
5368, 5371, 5379, 5381, 5383, 5397, 5399, 5401, 5403, 5405, 
5455, 5480, 5483, 5485, 5492, 5502, 5507, 5509, 5517, 5558, 
5988, 5992, 5994, 6003, 6350, 6463, 6601, 6962, 6980, 6982, 
6985, 6987, 6989, 6991, 6993, 6995, 6997, 7267, 7269, 7424, 
7426, 7428, 7885, 8007}

\end{document}
share|improve this answer
    
I am taking my time to select an answer because they are all good. I am afraid I went to bed after asking the question, so I don't know whose answer came first, yours or @egreg? They are very similar, but yours requires less code. I'll ask you the same question though - Could you explain why I can't use the S format in the tablular? Doesn't matter in this instance, but interested to know. –  FionaSmith Jun 6 at 10:38
    
And one more question: how would I change the delimeter in your example? I can see where to do it in @egreg's solution –  FionaSmith Jun 6 at 10:49
    
@egreg's solution was the first one. Mine is using the same logics but the loop is done with LaTeX's \@for which assumes your input is a comma separated list. –  Bordaigorl Jun 6 at 11:00
    
@FionaSmith and @David's one does support automatic pagebreaks if the table is too long to fit in one page while mine and @egreg's would need more work to accomplish that (maybe with the help of longtables) –  Bordaigorl Jun 6 at 11:02
    
Great, thanks for the explanation! –  FionaSmith Jun 6 at 12:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.