Set default tabular alignment

Is there a way to configure default tabular alignment. I would like every time I insert a new tabular environment it to be top aligned and the cells to be left aligned. Currently I have muscle memory for the shortcuts to set this up but doing it for every cell is cumbersome.

Thanks!

I’ll try and figure it out, but in the meantime, you mean “doing it for every table”, right?

Please take a look at the mailing list thread https://lists.texmacs.org/wws/arc/texmacs-users/2022-05/msg00036.html (started the day before yesterday). Maybe that is already enough for you.

Otherwise—the table menus are defined under progs/table/table-menu, but I do not know how the make function, which the menu item executes, works, and I am not able to learn it quickly enough to help you with that today.

Thank you for the tip, @pireddag!

I solved my problem by following your instructions and writing the following to my my-init-texmacs.scm:

(delayed (lazy-keyboard-force) 
 (kbd-map (:mode in-math?)
   ("math t" (make 'tabular*)
	  (table-set-valign "T")
	  (with old-mode (get-cell-mode)
		(set-cell-mode "table")
		(cell-set-halign "L")
		(set-cell-mode old-mode)))
))

Your solution from the post unfortunately had some shortcomings: the cursor was positioned wrong and if an expression was highlighted it got deleted; with the code above, the highlighted math gets put inside the cell of the table.

1 Like