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 a long table of 4 rows. I'd like help to make the table look better.

(based on comments, this is not possible to do using longtable. Is there a different table environment or package I can use to do this? as long as the data remains all in a table looking environment of some sort, I am ok with it).

The second row is small, and the third row is large. Latex leaves lots of empty space after the second row before starting the third row

Mathematica graphics

The third row is large, and longtable does not break this row but overflows to the bottom of the page. How to correct this output?

Mathematica graphics

MWE:

\documentclass[11pt]{article}
\usepackage{longtable}
\renewcommand{\arraystretch}{1.5}
\begin{document}

\begin{center}
\begin{longtable}[c]{|p{1.5in}|p{4.5in}|}\hline

Row 1&1, 286, 484, 507, 790, 920 \\\hline
Row 2&16, 22, 80, 81, 83, 86, 127, 188, 266, 365, 385, 394, 400, 402, 404, 413, 414, 416, 428, 429, 430, 451, 465, 467, 468, 479, 487, 489, 494, 504, 509, 513, 515, 523, 524, 527, 528, 530, 533, 534, 535, 538, 541, 542, 544, 546, 550, 555, 561, 566, 567, 570, 620, 638, 639, 640, 672, 701, 703, 706, 714, 730, 735, 743, 745, 746, 747, 752, 759, 769, 776, 782, 783, 784, 785, 786, 807, 854, 855, 862, 889, 892, 909, 913, 915, 916, 917, 918, 919, 922, 923, 925, 926, 929, 932, 942, 953, 961, 996, 1000 \\\hline
Row 3&2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 251, 252, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 267, 268, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, 333, 334, 335, 336, 337, 338, 339, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 366, 369, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 384, 386, 387, 388, 389, 390, 391, 392, 393, 396, 397, 398, 399, 401, 403, 405, 406, 407, 408, 409, 410, 411, 412, 415, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 453, 454, 455, 456, 457, 458, 459, 462, 463, 464, 466, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 481, 483, 486, 488, 490, 491, 492, 493, 495, 496, 497, 498, 499, 500, 501, 502, 505, 508, 511, 512, 514, 516, 517, 518, 519, 520, 521, 522, 525, 526, 529, 532, 536, 539, 540, 545, 547, 548, 549, 551, 552, 553, 554, 556, 557, 558, 559, 560, 562, 563, 564, 565, 568, 569, 571, 573, 574, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 702, 704, 705, 707, 708, 709, 710, 711, 712, 713, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 731, 732, 734, 736, 737, 738, 739, 740, 741, 742, 744, 748, 749, 750, 751, 753, 754, 755, 756, 757, 758, 760, 761, 762, 763, 764, 765, 766, 767, 768, 770, 771, 772, 773, 774, 775, 777, 778, 779, 780, 781, 787, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 836, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 856, 857, 858, 859, 860, 861, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 886, 887, 888, 890, 891, 893, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 910, 911, 912, 914, 921, 924, 927, 928, 930, 931, 933, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 954, 955, 956, 957, 958, 959, 960, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 997, 998, 999 \\\hline
Row 4&38, 47, 48, 49, 50, 55, 56, 74, 79, 82, 87, 110, 121, 202, 203, 205, 206, 219, 234, 237, 250, 253, 265, 269, 331, 340, 367, 368, 370, 383, 395, 452, 460, 461, 480, 482, 485, 503, 506, 510, 531, 537, 543, 572, 575, 576, 733, 788, 789, 835, 837, 885, 894\\\hline
\end{longtable}
\end{center}

\end{document}

Using texlive 2014

share|improve this question
    
According to the longtable document, "TEX will never break a page within such a row". That is, it will never break a row within a "p column". You'll have to manually break the row or use another table environment (I don't have any suggestions I'm afraid). –  Andrew Jul 21 at 7:38
    
@Andrew thanks. I'll update my question to ask for alternative solution to using long table in this case. –  Nasser Jul 21 at 7:39
2  
You can use a list instead. Those vertical lines aren't good looking anyway! –  Harish Kumar Jul 21 at 7:47
3  
99999 times out of 10 a 2 column table with large data in the second column is best set as a list (there are several duplicate questions saying this, I'll find some) –  David Carlisle Jul 21 at 8:12
1  

1 Answer 1

up vote 4 down vote accepted

The longtable environment is not capable of breaking a table inside a cell, and I doubt it will ever be. The true problem is that your table is semantically not a table, it is a list of lists. Therefore I would use one of the list environments:

\documentclass{article}

\begin{document}

\begin{description}

\item[Case 1.]
1, 286, 484, 507, 790, 920.

\item[Case 2.]
16, 22, 80, 81, 83, 86, 127, 188, 266, 365, 385, 394, 400, 402, 404, 413, 414, 416, 428, 429, 430, 451, 465, 467, 468, 479, 487, 489, 494, 504, 509, 513, 515, 523, 524, 527, 528, 530, 533, 534, 535, 538, 541, 542, 544, 546, 550, 555, 561, 566, 567, 570, 620, 638, 639, 640, 672, 701, 703, 706, 714, 730, 735, 743, 745, 746, 747, 752, 759, 769, 776, 782, 783, 784, 785, 786, 807, 854, 855, 862, 889, 892, 909, 913, 915, 916, 917, 918, 919, 922, 923, 925, 926, 929, 932, 942, 953, 961, 996, 1000.

\item[Case 3.]
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 51, 52, 53, 54, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 84, 85, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 235, 236, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 251, 252, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 267, 268, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 332, 333, 334, 335, 336, 337, 338, 339, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 366, 369, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 384, 386, 387, 388, 389, 390, 391, 392, 393, 396, 397, 398, 399, 401, 403, 405, 406, 407, 408, 409, 410, 411, 412, 415, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 453, 454, 455, 456, 457, 458, 459, 462, 463, 464, 466, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 481, 483, 486, 488, 490, 491, 492, 493, 495, 496, 497, 498, 499, 500, 501, 502, 505, 508, 511, 512, 514, 516, 517, 518, 519, 520, 521, 522, 525, 526, 529, 532, 536, 539, 540, 545, 547, 548, 549, 551, 552, 553, 554, 556, 557, 558, 559, 560, 562, 563, 564, 565, 568, 569, 571, 573, 574, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 702, 704, 705, 707, 708, 709, 710, 711, 712, 713, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 731, 732, 734, 736, 737, 738, 739, 740, 741, 742, 744, 748, 749, 750, 751, 753, 754, 755, 756, 757, 758, 760, 761, 762, 763, 764, 765, 766, 767, 768, 770, 771, 772, 773, 774, 775, 777, 778, 779, 780, 781, 787, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 836, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 856, 857, 858, 859, 860, 861, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 886, 887, 888, 890, 891, 893, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 910, 911, 912, 914, 921, 924, 927, 928, 930, 931, 933, 934, 935, 936, 937, 938, 939, 940, 941, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 954, 955, 956, 957, 958, 959, 960, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 997, 998, 999.

\item[Case 4.]
38, 47, 48, 49, 50, 55, 56, 74, 79, 82, 87, 110, 121, 202, 203, 205, 206, 219, 234, 237, 250, 253, 265, 269, 331, 340, 367, 368, 370, 383, 395, 452, 460, 461, 480, 482, 485, 503, 506, 510, 531, 537, 543, 572, 575, 576, 733, 788, 789, 835, 837, 885, 894.

\end{description}

\end{document}
share|improve this answer

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.