diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 601ef64..d298e81 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -137,7 +137,17 @@ (add-hook 'LaTeX-mode-hook (lambda () (local-set-key (kbd "C-z") 'my-tex) (local-set-key (kbd "C-c e") 'tex-close-latex-block) - (TeX-source-correlate-mode)))) + (TeX-source-correlate-mode))) + (defun latex-tsv-to-table () + "Converts tab-seperated-values to a LaTeX table." + (interactive) + (let ((beg (region-beginning)) (lines (count-lines (region-beginning) (region-end)))) + (save-excursion + (goto-char beg) + (indent-region beg (point)) + (replace-regexp "\t" " & " nil beg (point)) + (replace-regexp "$" " \\\\\\\\" nil beg (point)) + (align beg (point))))) (use-package fasd :config (global-set-key (kbd "C-x C-S-f") 'fasd-find-file)