2
$\begingroup$

I have a table given by

Module[
  {l = 10, list = StringTemplate["<* Range[l] *>"][]}, 
  TableForm[Table[{3*x, 4*x}, {x, 0, l}], 
    TableHeadings -> {{list}, {"3 x", "4 x"}}]]

The idea is to have a vertical column of incremental values of x as the left-hand TableHeadings. But instead, I get list as a single entry in curly braces:

enter image description here

Can someone tell me how to fix this?

$\endgroup$

closed as off-topic by C. E., Carl Lange, Alex Trounev, garej, MarcoB May 23 at 14:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – C. E., Carl Lange, Alex Trounev, garej, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ why not just Module[{l=10}, TableForm[Table[{3*x, 4*x}, {x, 0, l}], TableHeadings -> { Range[0,l], {"3 x", "4 x"}}]]? $\endgroup$ – kglr May 19 at 11:55
  • $\begingroup$ Simple answer - because I'm a doofus! Thanks @kglr. Could you promote that to answer status, and I'll give it a tick. $\endgroup$ – Richard Burke-Ward May 19 at 12:02
  • $\begingroup$ Richard, posted the comment as an answer. $\endgroup$ – kglr May 19 at 12:06
  • $\begingroup$ Ticked. Appreciated. $\endgroup$ – Richard Burke-Ward May 19 at 12:13
  • 1
    $\begingroup$ To be clear, the original issue is that the StringTemplate returns the string "{1,2,3,4,5,6,7,8,9,10}" and not the list {1,2,3,4,5,6,7,8,9,10}. $\endgroup$ – Carl Lange May 19 at 13:03
4
$\begingroup$
Module[{l = 10}, 
 TableForm[Table[{3*x, 4*x}, {x, 0, l}], 
  TableHeadings -> {Range[0, l], {"3 x", "4 x"}}]]

enter image description here

$\endgroup$

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