Fix bug #6051 by applying the patch from Pelle.

I could reproduce the warnings, and comparing the man output with and without
patch verified that the quotes were completely missing in the old version
while they are OK in the new one.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36846 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2010-12-12 19:39:21 +00:00
parent 5aedfc6b9f
commit 6f951a9821

View File

@ -22,15 +22,15 @@ options.
\fBtex2lyx\fR [ \fB\-userdir\fR \fIuserdir\fR ] [ \fB\-systemdir\fR \fIsystemdir\fR ]
[ \fB\-n\fR ] [ \fB\-c\fR \fItextclass\fR ] [\ \fB\-s\fR\ \fIsfile1\fR[,\fIsfile2\fR...]]
\fIinputfile\fR
." .PP
." \fBtex2lyx\fR [ \fB\-userdir\fR \fIuserdir\fR ] [ \fB\-systemdir\fR \fIsystemdir\fR ]
." [\ \fB\-r\fR\ \fIrenv1\fR[,\fIrenv2\fR...]] [\ \fB\-s\fR\ \fIsfile1\fR[,\fIsfile2\fR...]]
." \fIinputfiles\fR \fB\-p\fR \fB\-c\fR \fItextclass\fR
.\" .PP
.\" \fBtex2lyx\fR [ \fB\-userdir\fR \fIuserdir\fR ] [ \fB\-systemdir\fR \fIsystemdir\fR ]
.\" [\ \fB\-r\fR\ \fIrenv1\fR[,\fIrenv2\fR...]] [\ \fB\-s\fR\ \fIsfile1\fR[,\fIsfile2\fR...]]
.\" \fIinputfiles\fR \fB\-p\fR \fB\-c\fR \fItextclass\fR
.SH "OPTIONS"
.TP
.BI \-c
Class. By default, when \fBtex2lyx\fR sees a \f(CW\edocumentclass{foo}\fR command, it
creates a file of textclass \*(L"foo\*(R" and reads the LyX layout file for that class
creates a file of textclass \*[lq]foo\*[rq] and reads the LyX layout file for that class
(something like /usr/local/share/lyx/layouts/foo.layout \s-1OR\s0
\fB\s-1HOME\s0\fR/.lyx/layouts/foo.layout). Use \fB\-c\fR to declare a different textclass
(and read a different layout file).
@ -41,26 +41,26 @@ Use the \fB\-f\fR option (carefully) to clobber any existing files.
.TP
.BI \-n
Noweb. Translate a noweb (aka literate programming) file. This should be
(almost?) equivalent to running \*(L"noweb2lyx foo.tex foo.lyx\*(R". This option
(almost?) equivalent to running \*[lq]noweb2lyx foo.tex foo.lyx\*[rq]. This option
requires the \fB\-c\fR option.
." .TP
." .BI \-p
." Partial file. The input files are LaTeX fragments, with no preamble matter or
." \f(CW\ebegin{document}\fR commands. This option requires the \fB\-c\fR option, since there
." are no \f(CW\edocumentclass\fR commands in the files \fBtex2lyx\fR is translating. When
." using this option, you can translate more than one file, as long as all files
." are the same class. The LyX file created by \fBtex2lyx\fR can be included in an
." existing LyX file using the \*(L"Include LyX File\*(R" command from
." LyX's Insert menu. (\fBNOTE\fR: this feature of the older \fBreLyX\fR script has
." not yet been implemented in \fBtex2lyx\fR).
." .TP
." .BI \-r
." Regular environments (see the section on \fISyntax Files\fR). If you give more than one
." environment, separate them with commas (not spaces). You'll probably need to
." quote the environment list, especially if it has asterisk environments (foo*)
." in it. If you use this command often, considering creating a personal syntax
." file. (\fBNOTE\fR: this feature of the older \fBreLyX\fR script has
." not yet been implemented in \fBtex2lyx\fR).
.\" .TP
.\" .BI \-p
.\" Partial file. The input files are LaTeX fragments, with no preamble matter or
.\" \f(CW\ebegin{document}\fR commands. This option requires the \fB\-c\fR option, since there
.\" are no \f(CW\edocumentclass\fR commands in the files \fBtex2lyx\fR is translating. When
.\" using this option, you can translate more than one file, as long as all files
.\" are the same class. The LyX file created by \fBtex2lyx\fR can be included in an
.\" existing LyX file using the \*[lq]Include LyX File\*[rq] command from
.\" LyX's Insert menu. (\fBNOTE\fR: this feature of the older \fBreLyX\fR script has
.\" not yet been implemented in \fBtex2lyx\fR).
.\" .TP
.\" .BI \-r
.\" Regular environments (see the section on \fISyntax Files\fR). If you give more than one
.\" environment, separate them with commas (not spaces). You'll probably need to
.\" quote the environment list, especially if it has asterisk environments (foo*)
.\" in it. If you use this command often, considering creating a personal syntax
.\" file. (\fBNOTE\fR: this feature of the older \fBreLyX\fR script has
.\" not yet been implemented in \fBtex2lyx\fR).
.TP
.BI \-s
Syntax files. Input (one or more quoted, comma-separated) syntax files to read
@ -106,7 +106,7 @@ document into LyX.
Run \fBtex2lyx\fR.
.IP ""
\fBtex2lyx\fR will inform you of its progress and give any warnings to stderr, so if
you don't want any output at all, try (in csh) \*(L'tex2lyx foo.tex >& /dev/null\*(R'.
you don't want any output at all, try (in csh) `tex2lyx foo.tex >& /dev/null'.
You should \s-1NOT\s0 redirect standard output to \fIfoo.lyx\fR.
.IP "\(bu" 4
Run LyX (version 1.4 or later) on the resulting .lyx file.
@ -133,14 +133,14 @@ even though this leads to more TeX code and less \s-1WYSIWYM\s0.
.IP ""
I'm sure you were planning on doing this anyway, but it's particularly
important after translating a LaTeX document. \fBtex2lyx\fR is better
at \*(L"macro-translating\*(R" (translating the whole document) than
\*(L"micro-translating\*(R" (translating every little detail). For example, you may see
at \*[lq]macro-translating\*[rq] (translating the whole document) than
\*[lq]micro-translating\*[rq] (translating every little detail). For example, you may see
extra spaces or deleted spaces. Space handling has improved, but it's
not perfect.
.SS "What tex2lyx Can Handle"
\fBtex2lyx\fR understands many LaTeX commands. It will translate:
.IP "\(bu" 4
regular text, including mini-commands like ~, \*(L'\*(R', \f(CW\e@\fR, \f(CW\eTeX\fR, as well as
regular text, including mini-commands like ~, `', \f(CW\e@\fR, \f(CW\eTeX\fR, as well as
accented characters like \f(CW\e'{a}\fR, and the special cases ?` and !`
.IP "\(bu" 4
title commands like \f(CW\eauthor\fR, \f(CW\edate\fR, \f(CW\etitle\fR, \f(CW\ethanks\fR and the
@ -161,7 +161,7 @@ font-changing commands including \f(CW\eem\fR, \f(CW\eemph\fR, \f(CW\etextit\fR,
corresponding commands to change family, size, series, and shape
.IP "\(bu " 4
\f(CW\einput{foo}\fR (or \f(CW\einput{foo.blah}\fR) and \f(CW\einclude{foo}\fR. Plain TeX
\f(CW\einput\fR command \*(L"\f(CW\einput foo.tex\fR\*(R" is also supported.
\f(CW\einput\fR command \*[lq]\f(CW\einput foo.tex\fR\*[rq] is also supported.
.IP "\(bu" 4
tabular environment, and commands that go inside it like \f(CW\ehline\fR, \f(CW\ecline\fR,
and \f(CW\emulticolumn\fR (but see below)
@ -208,7 +208,7 @@ unknown (e.g., user-defined) environments and commands
.PP
\fBtex2lyx\fR copies unknown commands, along with their arguments, verbatim into the
LyX file. Also, if it sees a \f(CW\ebegin{foo}\fR where it doesn't recognize the
\*(L"foo\*(R" environment, it will copy verbatim until it sees \f(CW\eend{foo}\fR (unless
\*[lq]foo\*[rq] environment, it will copy verbatim until it sees \f(CW\eend{foo}\fR (unless
you use the \fB\-r\fR option). Most of these unknown commands
won't cause \fBtex2lyx\fR to break; they'll merely require you to do some editing
once you've loaded the file up in LyX. That should be less painful than
@ -217,14 +217,14 @@ editing either the .tex or the .lyx file using a text editor.
Since \fBtex2lyx\fR is relatively new, it's got a number of problems. As it
matures, these bugs will be squished.
.IP "\(bu" 4
\*(L"Exact\*(R" copying of unknown environments and commands isn't quite exact.
\*[lq]Exact\*[rq] copying of unknown environments and commands isn't quite exact.
This will yield ugly LyX, but in almost all cases the output will be the same.
However, most parts of the file will be copied perfectly, including whitespace
and comments. This includes: the LaTeX preamble, verbatim environments as well as
\f(CW\everb\fR commands, and skip blocks.
.IP "\(bu" 4
\fBtex2lyx\fR translates only a subset of the document class options to native features.
Other options are placed in the \*(L"options\*(R" field in the Document->Settings popup.
Other options are placed in the \*[lq]options\*[rq] field in the Document->Settings popup.
.IP ""
More importantly, \fBtex2lyx\fR doesn't translate \f(CW\enewcommands\fR, unknown
\f(CW\eusepackage\fR commands and other unknown code in the preamble. It
@ -257,7 +257,7 @@ For a number of commands (such as \f(CW\e\e\fR), LyX does not support the option
stdout. LyX also ignores the width argument for the thebibliography
environment.
.IP "\(bu" 4
LyX support for tables isn't perfect. For complicated tables, use a \*(L"skip\*(R"
LyX support for tables isn't perfect. For complicated tables, use a \*[lq]skip\*[rq]
block, so that they will be copied in TeX mode.
.IP "\(bu" 4
LyX allows figures to have sizes in the units known to TeX, such as in, cm, etc. It also
@ -266,14 +266,14 @@ translates percentages of \etextwidth, \etextheight, \ecolumnwidth, but no other
will copy figures with untranslatable sizes in TeX mode. Again, you might be able to fix
that within LyX.
.SH "EXAMPLES"
tex2lyx \fB\-f\fR \fB\-r\fR \*(L"myenv\*(R" foo.tex
tex2lyx \fB\-f\fR \fB\-r\fR \*[lq]myenv\*[rq] foo.tex
.PP
The above will create a file foo.lyx from foo.tex, overwriting if
necessary. When it finds a \f(CW\ebegin{myenv} ... \eend{myenv}\fR block, it will
translate the stuff within the block, but copy the \f(CW\ebegin\fR and \f(CW\eend\fR
commands in TeX mode.
.PP
tex2lyx \fB\-n\fR \fB\-c\fR \*(L"literate-article\*(R" foo.tex
tex2lyx \fB\-n\fR \fB\-c\fR \*[lq]literate-article\*[rq] foo.tex
.PP
The above will change a noweb document into a LyX literate-article
document. A user would do this if the noweb document had documentclass
@ -281,7 +281,7 @@ article.
.SH "NOTES"
.SS "Bug Reports"
Bugs should be reported to the LyX bug tracker at http://bugzilla.lyx.org. Additionally,
you can post a message to the LyX developers\*(R' mailing list. Its address is currently
you can post a message to the LyX developers' mailing list. Its address is currently
lyx-devel@lists.lyx.org. If your message bounces, you can check the LyX home page,
http://www.lyx.org/. If you are running \fBtex2lyx\fR on a huge file, please do not send all of the output in
your bug report. Just include the last ten or twenty lines of output, along with
@ -290,7 +290,7 @@ complete file which causes the same problem as your original file.
.SS "Layout Files"
\fBtex2lyx\fR reads a LyX layout file to know how to handle LaTeX environments and
commands which get translated to LyX layouts. This file will include all
\*(L"normal\*(R" non-math environments (i.e., including quote and itemize, but not
\*[lq]normal\*[rq] non-math environments (i.e., including quote and itemize, but not
tabular, minipage, and some other fancy environments), and commands like
\f(CW\esection\fR and \f(CW\etitle\fR. If you want to tex2lyx a class that doesn't have an
existing layout file, then you'll have to create a layout file. But you have
@ -323,14 +323,14 @@ as it finds. This means that it may copy too much. But since the user can
specify additional syntax files, that shouldn't happen often.
.PP
Some commands that cannot be translated to LyX, like \f(CW\embox\fR, have as one of
their arguments regular LaTeX text. If the string \*(L"translate\*(R" is put into an
their arguments regular LaTeX text. If the string \*[lq]translate\*[rq] is put into an
argument of an (untranslatable) command in the syntax file, then \fBtex2lyx\fR will
translate that argument instead of copying it verbatim. So, for example, the
default syntax file has \f(CW\eraisebox{}[][]{translate}\fR. This means that the
\f(CW\eraisebox\fR command and the first argument (and optional arguments if they
exist) are copied in TeX mode, but the last argument (which may contain math,
complicated LaTeX, other untranslatable commands, etc.) will be translated
into LyX. You can't use \*(L"translate\*(R" on optional arguments.
into LyX. You can't use \*[lq]translate\*[rq] on optional arguments.
.PP
User-defined syntax files are allowed to define new commands and
their syntax, or override the number of arguments for a command given in the
@ -340,12 +340,12 @@ copied in TeX mode. Commands which are actually translated by \fBtex2lyx\fR (lik
\f(CW\eitem\fR) have their argument syntax hard-coded. The hard-coded commands are
identified in the default syntax file.
.PP
Second, the syntax file describes any \*(L"regular environments\*(R". Usually, an
Second, the syntax file describes any \*[lq]regular environments\*[rq]. Usually, an
entire unknown environment will be copied in TeX mode. If you define a regular
environment \*(L"foo\*(R", though, then only the \f(CW\ebegin{foo}\fR and \f(CW\eend{foo}\fR
environment \*[lq]foo\*[rq], though, then only the \f(CW\ebegin{foo}\fR and \f(CW\eend{foo}\fR
commands will be copied in TeX mode; the text within the environment will be
treated (i.e., translated) by \fBtex2lyx\fR as regular LaTeX, rather than being
copied into TeX mode. Don't try to declare \*(L"tabbing\*(R" and \*(L"picture\*(R" as regular
copied into TeX mode. Don't try to declare \*[lq]tabbing\*[rq] and \*[lq]picture\*[rq] as regular
environments, as the text within those environments will confuse \fBtex2lyx\fR; use
this capability for new environments you create that have plain text or math
or simple commands in them. You also can't declare unknown math environments