[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: algorithm.el: Wrong usage of TeX-dialect
From: |
Uwe Brauer |
Subject: |
Re: algorithm.el: Wrong usage of TeX-dialect |
Date: |
Wed, 19 May 2021 09:32:13 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>>> "AE" == Arash Esbati <arash@gnu.org> writes:
Hi Arash
> Hi Uwe,
> in algorithm.el, `TeX-dialect' seems to be in the wrong place. It
> should be the optional third argument to `TeX-add-style-hook'.
Ok, I copied that from some older style file, therefore it might be
wrongly placed in other style files.
> Currently, it is placed inside the hook. I suggest the following
> change:
> diff --git a/style/algorithm.el b/style/algorithm.el
> index c493c829..73f0b5e6 100644
> --- a/style/algorithm.el
> +++ b/style/algorithm.el
> @@ -35,7 +35,6 @@
> '("section")
> "Package options for the algorithm package.")
> -
> (defun LaTeX-env-algorithm (environment)
> "Insert a algorithm-like ENVIRONMENT with caption and label."
> (let* ((pos (completing-read (TeX-argument-prompt t nil "Position")
> @@ -54,13 +53,8 @@
> (when (and short-caption (not (string= short-caption "")))
> (insert LaTeX-optop short-caption LaTeX-optcl))
> (insert TeX-grop caption)
> - ;; ask for a label and insert it
> - ; (LaTeX-label environment
> 'environment)
> - ;; the longtable `\caption' is equivalent to a
> - ;; `\multicolumn', so it needs a `\\' at the
> - ;; end of the line. Prior to that, add } to
> - ;; close `\caption{'
> - (insert TeX-grcl "")
> + ;; Add } to close `\caption{'
> + (insert TeX-grcl)
> ;; fill the caption
> (LaTeX-fill-paragraph)
> ;; Insert a new line and indent
> @@ -69,15 +63,13 @@
> (LaTeX-newline)
> (indent-according-to-mode))))
> -
> (TeX-add-style-hook
> "algorithm"
> (lambda ()
> (LaTeX-add-environments
> - '("algorithm" LaTeX-env-algorithm ))
> + '("algorithm" LaTeX-env-algorithm))
> (TeX-add-symbols
> - '("listofalgorithms" 0))
> - TeX-dialect))
> -
> + '("listofalgorithms" 0)))
> + TeX-dialect)
> ;;; algorithm.el ends here
> I think the code currently also inserts two blanks lines if the \label is
> omitted. This part
> ;; Insert a new line and indent
> (LaTeX-newline)
> (LaTeX-label environment 'environment)
> (LaTeX-newline)
> should read
> ;; Insert a new line and indent
> (LaTeX-newline)
> (when (LaTeX-label environment 'environment)
> (LaTeX-newline))
> Can you please have a look? TIA.
Do you want be to apply your patch, check, and then provide a patch?
I am a bit busy right now (end of the academic year in Spain) and in the
coming 2 weeks. I might have a look at the weekend, or do you prefer to
do it yourself.
Regards
Uwe
smime.p7s
Description: S/MIME cryptographic signature