0

I would like to have a function that inserts a table with 16 columns and 5 rows.

Then insert numbers from 1 to 15 in the first row (last column leaving it empty), and numbers 16 to 31 in the second column.

To make the table I use (table-insert 16 5 3 1). But I do not know how to fill the first two rows with the mentioned numbers automatically.

1 Answer 1

0

I know virtually nothing about the table package. I did C-h f table-insert to read what it does and then I did C-h f table-<TAB> and got a completion table. Scanning the completion table, I saw table-insert-sequence so I clicked on it and found that it does indeed fill out cells of a table sequentially. The rest was reading the details, looking at the examples and a bit of trial and error. That's basically what I always do with a new package and in this case I stopped here. But if I decide the package is useful, I then read the manual (if there is one) and/or the commentary in the file (table.el in this case) if there is one. Then over time and if necessary, I read (parts of) the code. I hope that's a useful description for how to approach new packages and that it will prove useful to you in the future.

Here's a function:

(defun my/table-make-and-stuff ()
   (table-insert 16 3 5 1)
   (table-insert-sequence "1" 15 1 1 'center)
   (table-forward-cell 16)
   (table-insert-sequence "16" 16 1 1 'center))

I assume that you mistyped the last word of the second paragraph of your question, IOW that you meant "row" instead of "column".

Editorializing a bit, I find Org mode tables much more useful and intuitive, even though they have some limitations in comparison (no multiline cells e.g.)

1
  • Correct, I meant to say as you described.
    – Dilna
    Sep 17, 2022 at 1:54

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.