TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to align the source .tex file in order to reflect final table.

Here is the result of calling align-current on my tabular's content.

    \hline  & {\em Execution Time (second)} \\ 
    \hline MPEG  & 123234                                             \\
    \hline MPEG with global reporting                     & 86987                                             
    \hline Gzip with all communication channels reporting & 86987         \\                                  

Where am I wrong , Maybe in the auto-fill mode of my ~.emacs

;;; Auto fill to wrap long lines
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default auto-fill-function 'do-auto-fill)

;;; No auto fill in some latex environments
(defvar my-LaTeX-no-autofill-environments
  '("tikzpicture" "lstlisting" "tabular" "spreadtab")
  "A list of LaTeX environment names in which `auto-fill-mode' should be inhibited.")

(defun my-LaTeX-auto-fill-function ()
  "This function checks whether point is currently inside one of
the LaTeX environments listed in
`my-LaTeX-no-autofill-environments'. If so, it inhibits automatic
filling of the current paragraph."
  (let ((do-auto-fill t)
        (current-environment "")
        (level 0))
    (while (and do-auto-fill (not (string= current-environment "document")))
      (setq level (1+ level)
            current-environment (LaTeX-current-environment level)
            do-auto-fill (not (member current-environment my-LaTeX-no-autofill-environments))))
    (when do-auto-fill

(defun my-LaTeX-setup-auto-fill ()
  "This function turns on auto-fill-mode and sets the function
used to fill a paragraph to `my-LaTeX-auto-fill-function'."
  (setq auto-fill-function 'my-LaTeX-auto-fill-function))

(add-hook 'LaTeX-mode-hook 'my-LaTeX-setup-auto-fill)
share|improve this question

closed as too localized by lockstep, Joseph Wright Oct 6 '12 at 21:23

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Related: LaTeX code sniffer and/or beautifier? – Werner Sep 17 '12 at 21:39
Is the missing \\ in the third row causing problems with the alignment algorithm? – Werner Sep 17 '12 at 21:52
I tested this as shown, without the missing \` and align-current` does the job. I also evaluated your posted portion of your .emacs and it still works as expected. Does this happen in every file or only in this one? – Ricardo Oct 2 '12 at 18:02
Just in case others reach this question, the problem saw the font that wasn't a fixed width font. Changing to monofont for example, solved the issue. – Manuel Selva Feb 20 '13 at 13:44

Browse other questions tagged or ask your own question.