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

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]
share|improve this question
add comment

3 Answers 3

up vote 3 down vote accepted

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

share|improve this answer
    
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 –  Mika Ike May 5 at 12:47
    
PERFECT!!!!!!!!! –  Mika Ike May 5 at 12:58
add comment

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
share|improve this answer
add comment

Shorter solution

c = Table[{{i, i + 1, i + 3}, i + 4, i + 5, N[1/i]}, {i, 1, 34}];
TableForm[c, TableDepth -> 2]
share|improve this answer
add comment

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.