1
$\begingroup$

How to print the table with the first column as $\{1,2,3\}$ instead of $\begin{array}{c} 1 \\ 2 \\ 3 \\\end{array}$?

a = {{1, 2, 3}, 1, 4, 9};
b = {{4, 6, 2}, 16, 36, 4};
TableForm[{a, b}]

enter image description here

The aim would be to handle the following example:

c = Table[{{i, i + 1, i + 3}, i + 4, i + 5, N[1/i]}, {i, 1, 34}];
TableForm[c]
$\endgroup$
3
$\begingroup$

Assuming that this it what you meant:

a = {HoldForm@{1, 2, 3}, 1, 4, 9};
b = {HoldForm@{4, 6, 2}, 16, 36, 4};
TableForm[{a, b}]

enter image description here

If you have a bigger list (see comment) you can do that:

c = Table[{{i, i + 1, i + 3}, i + 4, i + 5, N[1/i]}, {i, 1, 34}];
TableForm[Prepend[#[[2 ;;]], HoldForm@(Evaluate@First@#)] & /@ c]

Only the first 10 lines are shown bellow

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank You, your solution is perfect!! but... I put onli 2 lineas ( a and b) but I have 60 or 80 lines y a list history, where each line is on the estyle {{1,2,3},4,5,0.21212,6,6} Could you edit with any sol to this case $\endgroup$
    – Mika Ike
    May 5 '14 at 12:47
  • $\begingroup$ PERFECT!!!!!!!!! $\endgroup$
    – Mika Ike
    May 5 '14 at 12:58
3
$\begingroup$

Shorter solution

c = Table[{{i, i + 1, i + 3}, i + 4, i + 5, N[1/i]}, {i, 1, 34}];
TableForm[c, TableDepth -> 2]
$\endgroup$
2
$\begingroup$

You can also do that as follows:

c = Table[{HoldForm@Evaluate[{i, i + 1, i + 3}], i + 4, i + 5, 
N[1/i]}, {i, 1, 34}] // TableForm
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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