1
$\begingroup$

This is a data in LaTeX, I input by my hand.

7&9&9&10&9&10&7&8&10&8\\
6&7&9&9&10&10&10&9&9&9\\
8&8&7&9&9&9&9&9&9&8\\
9&9&8&10&9&10&7&6&9&9\\

enter image description here

How can I make a table containt 10 columns and 3 rows randomly like form of LaTeX by Mathematica.

a&b&c&d&e&&f&g&h&k\\
a&b&c&d&e&&f&g&h&k\\
8&8&7&9&9&9&9&9&9&8\\
9&9&8&10&9&10&7&6&9&9\\

I think about

Clear["Global`*"]
Table[{a, b, c, a, b, c, a, b, c, a}, {a, 5, 9}, {b, 2, 5}, {c, 4, 7}];
Flatten[%, 2]
$\endgroup$
4
  • $\begingroup$ Why not RandomInteger[100, {3, 10}] which gives random matrix of 3 rows and 10 columns,. You can change the 100 to any other value you want. see help $\endgroup$
    – Nasser
    Commented Jun 15 at 0:51
  • $\begingroup$ I tried RandomInteger[10, {3, 10}], I got {{2, 9, 9, 2, 5, 5, 8, 3, 8, 4}, {0, 7, 7, 6, 2, 0, 8, 8, 2, 9}, {5, 8, 8, 9, 7, 2, 4, 3, 6, 5}}, How can I replace , to &, in each element? $\endgroup$ Commented Jun 15 at 1:11
  • $\begingroup$ How can I replace , to & That is what TeXForm does automatically. I thought you knew about TeXForm $\endgroup$
    – Nasser
    Commented Jun 15 at 2:07
  • $\begingroup$ Thank you very much. I know about TeXForm. $\endgroup$ Commented Jun 15 at 2:13

1 Answer 1

6
$\begingroup$
TeXForm[RandomInteger[10, {3, 10}]]

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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