GNU bug report logs - #28382
11.90.2.2017-07-25; Wrapping content in an equation with LaTeX-environment results in invalid LaTeX

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: auctex; Reported by: Thibaut Verron <thibaut.verron@HIDDEN>; dated Thu, 7 Sep 2017 13:21:02 UTC; Maintainer for auctex is bug-auctex@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Sep 2017 13:20:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 07 09:20:04 2017
Received: from localhost ([127.0.0.1]:53956 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dpwiy-0005h3-Is
	for submit <at> debbugs.gnu.org; Thu, 07 Sep 2017 09:20:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:34422)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <thibaut.verron@HIDDEN>) id 1dpwix-0005gV-3F
 for submit <at> debbugs.gnu.org; Thu, 07 Sep 2017 09:20:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <thibaut.verron@HIDDEN>) id 1dpwim-0002rN-PQ
 for submit <at> debbugs.gnu.org; Thu, 07 Sep 2017 09:19:57 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:49945)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <thibaut.verron@HIDDEN>)
 id 1dpwim-0002rI-LF
 for submit <at> debbugs.gnu.org; Thu, 07 Sep 2017 09:19:52 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53589)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <thibaut.verron@HIDDEN>) id 1dpwih-00066m-FA
 for bug-auctex@HIDDEN; Thu, 07 Sep 2017 09:19:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <thibaut.verron@HIDDEN>) id 1dpwic-0002n0-DH
 for bug-auctex@HIDDEN; Thu, 07 Sep 2017 09:19:47 -0400
Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:34247)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <thibaut.verron@HIDDEN>)
 id 1dpwic-0002ki-3V
 for bug-auctex@HIDDEN; Thu, 07 Sep 2017 09:19:42 -0400
Received: by mail-wm0-x235.google.com with SMTP id 137so33904000wmj.1
 for <bug-auctex@HIDDEN>; Thu, 07 Sep 2017 06:19:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=to:subject:from:message-id:date:user-agent:mime-version
 :content-transfer-encoding;
 bh=YvdEL8LC+pQzhXo1029bOVfm84v1xV9TAac6TG0i7U0=;
 b=hR2Y6pYYUswC3iUZmj/0pmIvcIABv4xfGdoYaxPbmsPuZoGEqg50T2ywT8nfcE/VC9
 R1nUIzfcW4t44G4kTxD+aLJ7CQchlFCt0WgBkpJkhnvE5ZAIjIckE4EckIYiHZ5Sn+An
 jy8pZgcuQpRMZOhEInGQlbty8cxL+O19VXVd7jXsOhyndTHGYv7yjBtkJVfbJoHq9MMo
 JzO1N17qkfyVGxu7fW9PoYE3Zr5MNgJdc/a2swsbXmmcT1Q4BWgB/6iCIdRbVeSe2W1K
 yT3toLZdy0/ddMgCLUnzsE06UDt2t73/y9tImuMOC+ho4I6BOqAAo9UBUbzofzGSi0+B
 2fJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:to:subject:from:message-id:date:user-agent
 :mime-version:content-transfer-encoding;
 bh=YvdEL8LC+pQzhXo1029bOVfm84v1xV9TAac6TG0i7U0=;
 b=IyPe+4Yo485NWIFgEMUfLQ0fGAzahMkcca6kvnbeWcapgX6qzisB4I3ezvlz8f00kl
 hdBf80kVtEiWmAwYJJpxXSLM+6QhAKtFyo9uPl7j1lfURY1fAjjx3L51BYVWULCzFdR9
 jV5s7n1ekMQ3YvGb475Uyzs+H0zyD9BnE1ofDTzg6NiUNPLieTBpkWW//g76FvYtKT64
 XBiazJGGh3+5tRMiyD+3M8oW4RQSriqS6zsdRuSFgHAVviWPzEgiMMiRaeEguLtPmTzw
 hMpU+fYBY/IvQwM9Ozps61JudjF2BctnLWItqeqYvIFtp7GdiuCfujwgwAYsQgAKo3VU
 gRWQ==
X-Gm-Message-State: AHPjjUhvnHTfKxNxHJnudm/ZJ8gItjXDSCMyBCLZ//MwWXcvRI96TedC
 WoqB0eyZrLahLqa2OGY=
X-Google-Smtp-Source: ADKCNb6Mgcfa+lTllDrVg8rsOIQYrLJk1iSZZUOhSqQmmPeuaAbZW+TsRgCSofIkbCszDz/h7/eS1w==
X-Received: by 10.28.20.18 with SMTP id 18mr692303wmu.7.1504790379033;
 Thu, 07 Sep 2017 06:19:39 -0700 (PDT)
Received: from [147.127.240.134] ([147.127.240.134])
 by smtp.gmail.com with ESMTPSA id g37sm4438754wra.6.2017.09.07.06.19.36
 for <bug-auctex@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 07 Sep 2017 06:19:37 -0700 (PDT)
To: bug-auctex@HIDDEN
Subject: 11.90.2.2017-07-25; Wrapping content in an equation with
 LaTeX-environment results in invalid LaTeX
From: Thibaut Verron <thibaut.verron@HIDDEN>
Message-ID: <9f8a7b2e-d877-10a9-b13b-3b82766d75b5@HIDDEN>
Date: Thu, 7 Sep 2017 15:20:04 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Hello,

If you use `C-c C-e` (`LaTeX-environment`) to insert an "equation"
environment, the result is

\begin{equation}
\label{eq:1}
[point here]
\end{equation}

This is valid LaTeX assuming that the user actually types a formula in.

If now you insert the equation first, select it, and use `C-c C-e` to
wrap it in an "equation" environment, the result is

\begin{equation}
2+2=4\label{eq:2}
[point here]
\end{equation}

This raises a compilation error: an equation cannot contain an empty line.
And with the label at the end of the formula, it isn't convenient in
case the formula wasn't complete either.

In my opinion, the expected output would be either

\begin{equation}
\label{eq:2}
2+2=4
\end{equation}
[point here]

or

\begin{equation}
\label{eq:2}
2+2=4[point here]
\end{equation}

depending on whether you expect the user to wrap complete formulae or
not. I personally almost always wrap complete formulae, so I'd choose
option 1.

In the expected output, I also moved the `\label{...}` to the beginning
of the environment instead of the end. It is the recommended way of
proceeding, but I don't know if it makes any real difference for the
compiler. If anything, it would make equation labelling consistent with 
what
is produced with `C-c C-e` with the mark inactive.

The same thing happens with similar environments. For unlabeled
environments, the output is similar to option 2 above, which seems to
hint that the newline appears when inserting the `\label`.

Is there a good reason that I missed for the current behavior?

Thanks,

Thibaut


Emacs : GNU Emacs 25.1.4 (x86_64-pc-linux-gnu, GTK+ Version 2.24.30)
of 2016-11-08
Package: 11.90.2.2017-07-25

current state:
==============
(setq
AUCTeX-date "2017-07-25"
window-system 'x
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex" 
"/home/controleapo/.emacs.d/elpa/auctex-11.91.0/style"
"/home/controleapo/.emacs.d/auctex/auto" 
"/home/controleapo/.emacs.d/auctex/style"
"auto" "style")
TeX-auto-save t
TeX-parse-self t
TeX-master nil
TeX-command-list '(("LatexMk" "latexmk %(-PDF)%S%(mode) 
%(file-line-error) %(extraopts) %t"
TeX-run-latexmk nil (plain-tex-mode latex-mode doctex-mode) :help "Run 
LatexMk")
("TeX" "%(PDF)%(tex) %(file-line-error) %(extraopts) 
%`%S%(PDFout)%(mode)%' %t"
TeX-run-TeX nil (plain-tex-mode ams-tex-mode texinfo-mode) :help
"Run plain TeX")
("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help
"Run LaTeX")
("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil 
(texinfo-mode) :help
"Run Makeinfo with Info output")
("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with HTML output")
("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t" TeX-run-TeX nil
(ams-tex-mode) :help "Run AMSTeX")
("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" 
TeX-run-TeX
nil (context-mode) :help "Run ConTeXt once")
("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil
(context-mode) :help "Run ConTeXt until completion")
("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
("Print" "%p" TeX-run-command t t :help "Print the file")
("Queue" "%q" TeX-run-background nil t :help "View the printer queue" 
:visible
TeX-queue-command)
("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help
"Generate PostScript file")
("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help
"Convert DVI file to PostScript")
("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
"Convert DVI file to PDF with dvipdfmx")
("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
"Convert PostScript file to PDF")
("Glossaries" "makeglossaries %s" TeX-run-command nil t :help
"Run makeglossaries to create glossary file")
("Index" "makeindex %s" TeX-run-index nil t :help
"Run makeindex to create index file")
("upMendex" "upmendex %s" TeX-run-index t t :help
"Run upmendex to create index file")
("Xindy" "texindy %s" TeX-run-command nil t :help
"Run xindy to create index file")
("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
"Check LaTeX file for correctness")
("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help
"Check LaTeX file for common mistakes")
("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help
"Spell-check the document")
("Clean" "TeX-clean" TeX-run-function nil t :help
"Delete generated intermediate files")
("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
"Delete generated intermediate and output files")
("Other" "" TeX-run-command t t :help "Run an arbitrary command"))
)





Acknowledgement sent to Thibaut Verron <thibaut.verron@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-auctex@HIDDEN. Full text available.
Report forwarded to bug-auctex@HIDDEN:
bug#28382; Package auctex. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 7 Sep 2017 13:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.