Opened 21 years ago

Closed 20 years ago

Last modified 15 years ago

#1225 closed defect (fixed)

Environment \end tag causes problems

Reported by: Juergen Spitzmueller Owned by: dekel
Priority: high Milestone:
Component: latex export Version: 1.3.4
Severity: normal Keywords:
Cc: munzirtaha@…

Description

the \end{environment} tag should be placed on a new line. As it is now, it leads to LaTeX
errors in some cases, e.g. arabtex:

Munzir Taha Obeid wrote:

The problem:


I open lyx and wrote some Arabic. View -> PDF (pdflatex) gives this error

LaTeX Error: \begin{arabtext} on input line 12 ended by \end{document}.

\end{document}

Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.

[...]

Better Workaround:


Open the latex file in an editor and add a space before any closing LaTeX
code within the \begin{arabtext} and the \end{arabtext}. I mean a space
should be entered before \end{arabtext} and if you have any formatting say
you centered some text you should go to the latex file and add a space
before the \end{center} or you get errors like this:

! LaTeX Error: \begin{center} on input line 11 ended by \end{document}.

Attachments (4)

end.diff (1.0 KB ) - added by Juergen Spitzmueller 21 years ago.
possible fix
BugTest.lyx (653 bytes ) - added by munzirtaha@… 20 years ago.
A sample test LyX file that shows the bug
BugTest.tex (399 bytes ) - added by munzirtaha@… 20 years ago.
The exported TeX file from the sample test BugTest.lyx file
bug1225.tex (368 bytes ) - added by lasgouttes 20 years ago.
Here is what I get with attachment 552

Download all attachments as: .zip

Change History (19)

by Juergen Spitzmueller, 21 years ago

Attachment: end.diff added

possible fix

comment:1 by munzirtaha@…, 21 years ago

Cc: munzirtaha@… added

comment:2 by Juergen Spitzmueller, 21 years ago

attachments.isobsolete: 01

(From update of attachment 429)
wrong fix (see comment)

comment:3 by Juergen Spitzmueller, 21 years ago

Correction: the \end tag is only misplaced (i.e. not in a new line) if the environment is at the
very end of the document, i.e. the end tag is the last thing before \end{document}. A blank line
is then placed *after" the \end tag istead.
Regarding the arabtex issue: Munzir Taha confirmed that adding a space solves the LaTeX
error. We should figure out why LyX does not add a linebreak at this position.

comment:4 by munzirtaha@…, 21 years ago

I want to emphasize it again. Bear with me, please.


There are two errors here:
Error #1: An error when we want to view a document that contains Arabic text through
view -> PDF.

LaTeX Error: \begin{arabtext} on input line 16 ended by \end{document}.

\end{document}


Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.

The above error will occur only and only if the paragraph direction that contains Arabic is
right to left, and this happen when the first letter in the paragraph is Arabic. The
workaround is just to insert a space or any whitespace after the last Arabic letter.

Error #2: If we want to generate the PDF file through File -> Export -> LaTeX, then use
texi2pdf. In this case I get these errors:

LaTeX Warning: Unused global option(s):

[arabic,english].


(./basmala.aux) (/usr/share/texmf/tex/latex/arabtex/uxnsh.fd) . / . / ##

! LaTeX Error: \begin{arabtext} on input line 14 ended by \end{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.

...


l.17 \end{document}

?
--
A space at the end of the file won't solve the problem if it contains some formatting. For
example if the tex file looks like this

\begin{document}
\begin{arabtext}
\begin{center}ÈÓå Çääç\end{center}

ÈÓå Çääç\end{arabtext}

\end{document}

I need to add a space before \end{center} AND \end{document}. In short a space before
any LaTeX code that follows an Arabic text. You can also see here the the line added
after \end{arabtext} which should be before it as Juergen Spitzmueller noticed already.

Note: to edit the LaTeX file I have to use katoob or vim since the other editors I am aware
of (like kwrite, kedit, ...) will corrupt any Arabic text encoded in iso 8859-6.


comment:5 by lasgouttes, 20 years ago

dependson: 1404
Status: newassigned
Version: 1.3.21.3.4

The patch for 1404 should fix this one too

comment:6 by lasgouttes, 20 years ago

Subject: lyx-devel /: Tag: BRANCH_1_3_X status.13x src/: ...

CVSROOT: /usr/local/lyx/cvsroot
Module name: lyx-devel
Repository: lyx-devel/src/
Changes by: lasgouttes@… 04/04/22 15:58:28

Modified files:

lyx-devel/: Tag: BRANCH_1_3_X status.13x
lyx-devel/src/: Tag: BRANCH_1_3_X ChangeLog paragraph.C

Log message:

fix arabtex-related problems (#1225 and #1404)

Bugs:
#1225
#1404

Patches:
http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/status.13x?r1=1.1.2.178&r2=1.1.2.179
http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/src/ChangeLog?r1=1.1021.2.33&r2=1.1021.2.34
http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/src/paragraph.C?r1=1.235.2.1&r2=1.235.2.2

Complete Diff:
/usr/bin/cvs -f diff -kk -u -r 1.1.2.178 -r 1.1.2.179 /status.13x
/usr/bin/cvs -f diff -kk -u -r 1.1021.2.33 -r 1.1021.2.34 src/ChangeLog
/usr/bin/cvs -f diff -kk -u -r 1.235.2.1 -r 1.235.2.2 src/paragraph.C

comment:7 by lasgouttes, 20 years ago

Subject: lyx-devel src/: ChangeLog output_latex.C

CVSROOT: /usr/local/lyx/cvsroot
Module name: lyx-devel
Repository: lyx-devel/src/
Changes by: lasgouttes@… 04/04/22 15:59:39

Modified files:

lyx-devel/src/: ChangeLog output_latex.C

Log message:

fix arabtex-related problems (#1225 and #1404)

Bugs:
#1225
#1404

Patches:
http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/src/ChangeLog?r1=1.1902&r2=1.1903
http://www.lyx.org/cgi-bin/viewcvs.cgi/lyx-devel/src/output_latex.C?r1=1.11&r2=1.12

Complete Diff:
/usr/bin/cvs -f diff -kk -u -r 1.1902 -r 1.1903 src/ChangeLog
/usr/bin/cvs -f diff -kk -u -r 1.11 -r 1.12 src/output_latex.C

comment:8 by lasgouttes, 20 years ago

Resolution: fixed
Status: assignedclosed

.

by munzirtaha@…, 20 years ago

Attachment: BugTest.lyx added

A sample test LyX file that shows the bug

by munzirtaha@…, 20 years ago

Attachment: BugTest.tex added

The exported TeX file from the sample test BugTest.lyx file

comment:9 by munzirtaha@…, 20 years ago

Resolution: fixed
Status: closedreopened

I downloaded the patch and applied it to LyX 1.3.4. I have found that although
it fixed the problem of OneParagraph, it caused another problem in case of
more than one paragraph. The Attach LyX file used to work without the patch. I
also attached the exported .tex file. I hope you can figure out what's wrong
easily so we finish this long awaiting issue. Thanks a lot for your care.

comment:10 by munzirtaha@…, 20 years ago

You can see how the order is again messed in the attached TeX file

\begin{arabtex}
1

\begin{doublespace}
2
\end{arabtex}\end{doublespace}

by lasgouttes, 20 years ago

Attachment: bug1225.tex added

Here is what I get with attachment 552

comment:11 by lasgouttes, 20 years ago

Status: reopenedassigned

Munzir,

Did you test the patch from #1404?

To test the patch that was actually applied (which should be the same),
you can use the last link of comment 6.

comment:12 by lasgouttes, 20 years ago

Oops! It turns out that I tested on a build that was not up to date.

So Munzir, ignore my last comments. I can indeed confirm that it is worse than
it used to be in this case...

comment:13 by lasgouttes, 20 years ago

attachments.isobsolete: 01

(From update of attachment 555)
[update: this is meaningless. I goofed.]

comment:14 by lasgouttes, 20 years ago

Resolution: fixed
Status: assignedclosed

This particular bug is fixed, as far as I am concerned. Let's continue
the discussion in #1404

comment:15 by munzirtaha@…, 20 years ago

no problem. When can we expect a fix to this (#1404) 1-year old bug? ;)
I am eager to remove it from my wiki.arabeyes.org/OpenBugs page

Note: See TracTickets for help on using tickets.