What would be the best way to write out the terms of a sequence, somehow like this, but preferably aligned?
Is there a way to automatically generate the terms from an equation i.e. with n² for sequence (3)?
If so, how could one write the relation between the terms and their indexes like so:
Best Answer
The following is for automated generation. It wasn't clear what "aligned" was supposed to mean. Thus I have applied various methods.
The
\xintFor
is used only when some formatting is needed, for example printing fractions asA/B
is not enough one wants\frac{A}{B}
, or when one wants to replace the commas by tab stops for alignment.Technical note:
\xintFor
works with comma separated values; the list may be encapsulated in a macro, but this macro is expanded only once. Hence, for simplicity we first construct the list by an\edef
(we could have use a\romannumeral-`0
prefix rather).Second technical note: the list (4) of square roots uses the trick to prefix the number with a sign if it is not found to be a perfect square. Then the formatting checks for this sign.
The list numbered (10) in OP seems to have an issue. I don't understand the
4/4
. A4/5
fits well with the rest, though.