version 2 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
RELYX |
|
|
2 |
!!!RELYX |
|
|
3 |
N NA AM ME E |
|
|
4 |
S SY YN NO OP PS SI IS S |
|
|
5 |
O OP PT TI IO ON NS S |
|
|
6 |
D DE ES SC CR RI IP PT TI IO ON N |
|
|
7 |
E EX XA AM MP PL LE ES S |
|
|
8 |
N NO OT TE ES S |
|
|
9 |
D DI IA AG GN NO OS ST TI IC CS S |
|
|
10 |
W WA AR RN NI IN NG GS S |
|
|
11 |
F FI IL LE ES S |
|
|
12 |
S SE EE E A AL LS SO O |
|
|
13 |
A AU UT TH HO OR RS S |
|
|
14 |
---- |
|
|
15 |
!!N NA AM ME E |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__rreeLLyyXX__ - translate well-behaved LaTeX into LyX |
|
|
19 |
!!S SY YN NO OP PS SI IS S |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
The simplest way to use __rreeLLyyXX__ is via the |
|
|
23 |
File- |
|
|
24 |
__rreeLLyyXX__ on |
|
|
25 |
the given file and loads the resulting file into LyX. You |
|
|
26 |
should try that first, and call it from the command line |
|
|
27 |
only if you need to use more complicated |
|
|
28 |
options. |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
__rreeLLyyXX__ [[ __--cc__ ''textclass'' ] [[ |
|
|
32 |
__--ddff__ ] [[ __--oo__ ''outputdir'' ] |
|
|
33 |
[[__--nn__] [[ __--rr__ ''renv1''[[,''renv2''...]] |
|
|
34 |
[[ __--ss__ ''sfile1''[[,''sfile2''...]] |
|
|
35 |
''inputfile'' |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
__rreeLLyyXX --pp --cc__ ''textclass'' [[ __--ddff__ |
|
|
39 |
] [[ __--oo__ ''outputdir'' ] [[ __--rr__ |
|
|
40 |
''renv1''[[,''renv2''...]] [[ __--ss__ |
|
|
41 |
''sfile1''[[,''sfile2''...]] |
|
|
42 |
''inputfiles'' |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
__rreeLLyyXX --hh__ |
|
|
46 |
!!O OP PT TI IO ON NS S |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
__--cc__ |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
Class. By default, when __rreeLLyyXX__ sees a |
|
|
53 |
documentclass{foo} command, it creates a file of |
|
|
54 |
textclass ``foo'' and reads the LyX layout file for that |
|
|
55 |
class (something like |
|
|
56 |
/usr/local/share/lyx/layouts/foo.layout OR |
|
|
57 |
__HHOOMMEE__ /.lyx/layouts/foo.layout). Use |
|
|
58 |
__--cc__ to declare a different textclass (and read a |
|
|
59 |
different layout file). |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
__--dd__ |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
Debug. By default, __rreeLLyyXX__ gives sparse output and |
|
|
66 |
deletes the temporary files which were created during |
|
|
67 |
translation. Using the __--dd__ flag will create much |
|
|
68 |
more output (both to stdout and stderr) and leave the |
|
|
69 |
temporary files around. |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
__--ff__ |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
Force. __rreeLLyyXX__ will not run if the .lyx file it |
|
|
76 |
would generate already exists Use the __--ff__ option |
|
|
77 |
(carefully) to clobber any existing files. |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
__--hh__ |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
Help. Print out usage information and quit. |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
__--nn__ |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
Noweb. Translate a noweb (aka literate programming) file. |
|
|
90 |
This should be (almost?) equivalent to running ``noweb2lyx |
|
|
91 |
foo.tex foo.lyx''. This option requires the __--cc__ |
|
|
92 |
option. |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
__--oo__ |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
Output directory. With this option, all temporary files and |
|
|
99 |
LyX output files (for the given input file, for any included |
|
|
100 |
files, or for any file fragments given with the __--pp__ |
|
|
101 |
option) will be put into ''outputdir''. Otherwise, for |
|
|
102 |
each file ''dir/foo.tex'', the temporary files and the |
|
|
103 |
LyX output file will be created in ''dir''. This can be |
|
|
104 |
useful if a file includes files from other directories which |
|
|
105 |
you want to consolidate in one directory, or if you don't |
|
|
106 |
have write permission on the directory the LaTeX files are |
|
|
107 |
in. |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
__--pp__ |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
Partial file. The input files are LaTeX fragments, with no |
|
|
114 |
preamble matter or begin{document} commands. This |
|
|
115 |
option requires the __--cc__ option, since there are no |
|
|
116 |
documentclass commands in the files |
|
|
117 |
__rreeLLyyXX__ is translating. When using this option, |
|
|
118 |
you can translate more than one file, as long as all files |
|
|
119 |
are the same class. The LyX file created by |
|
|
120 |
__rreeLLyyXX__ can be included in an existing LyX file |
|
|
121 |
using the ``Include LyX File'' command from LyX's Insert |
|
|
122 |
menu. |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
__--rr__ |
|
|
126 |
|
|
|
127 |
|
|
|
128 |
Regular environments (see the section on ''Syntax |
|
|
129 |
Files''). If you give more than one environment, separate |
|
|
130 |
them with commas (not spaces). You'll probably need to quote |
|
|
131 |
the environment list, especially if it has asterisk |
|
|
132 |
environments (foo*) in it. If you use this command often, |
|
|
133 |
considering creating a personal syntax file. |
|
|
134 |
|
|
|
135 |
|
|
|
136 |
__--ss__ |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
Syntax files. Input (one or more quoted, comma-separated) |
|
|
140 |
syntax files to read in addition to the default. (see the |
|
|
141 |
section on ''Syntax Files'' for details). |
|
|
142 |
!!D DE ES SC CR RI IP PT TI IO ON N |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
__IInnttrroodduuccttiioonn__ |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
__rreeLLyyXX__ will create a LyX file ''dir/foo.lyx'' |
|
|
149 |
from the LaTeX file ''dir/foo.tex'' (unless the |
|
|
150 |
__--oo__ option is used). |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
Suffixes .tex, .ltx and .latex are supported. If |
|
|
154 |
''inputfile'' does not exist and does not have one of |
|
|
155 |
these suffixes, __rreeLLyyXX__ will try to translate |
|
|
156 |
''inputfile.tex''. (This is similar to the behavior of |
|
|
157 |
LaTeX.) |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
The purpose of __rreeLLyyXX__ is to translate |
|
|
161 |
''well-behaved'' LaTeX2e into LyX. If your LaTeX file |
|
|
162 |
doesn't compile---or if you do weird things, like redefining |
|
|
163 |
standard !LaTex commands---it may choke. LaTeX209 will often |
|
|
164 |
be translated correctly, but it's not |
|
|
165 |
guaranteed. |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
__rreeLLyyXX__ has some bugs and lacks a few features. |
|
|
169 |
However, its main goals are: |
|
|
170 |
|
|
|
171 |
|
|
|
172 |
Get through a well-behaved LaTeX2e file without |
|
|
173 |
crashing |
|
|
174 |
|
|
|
175 |
|
|
|
176 |
Translate a lot of that file. |
|
|
177 |
|
|
|
178 |
|
|
|
179 |
Localize the parts that can't be translated and copy them in |
|
|
180 |
TeX mode |
|
|
181 |
|
|
|
182 |
|
|
|
183 |
It achieves these main goals pretty well on most |
|
|
184 |
files. |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
There are many improvements that can and will be made to |
|
|
188 |
__rreeLLyyXX__ in the future. However, we wanted to get |
|
|
189 |
__rreeLLyyXX__ out there early on, to make it easier for |
|
|
190 |
new LyX users to read in their existing LaTeX |
|
|
191 |
files. |
|
|
192 |
|
|
|
193 |
|
|
|
194 |
__UUssaaggee__ |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
Here's a more lengthy description of what you should do to |
|
|
198 |
translate a LaTeX document into LyX. |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
Run __rreeLLyyXX__. |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
__rreeLLyyXX__ will inform you of its progress and give |
|
|
205 |
any warnings to stderr, so if you don't want any output at |
|
|
206 |
all, try (in csh) `reLyX foo.tex |
|
|
207 |
__NOT redirect standard output to |
|
|
208 |
''foo.lyx''. |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
Run LyX (version 0.12 or 1.0 or later) on the resulting .lyx |
|
|
212 |
file. |
|
|
213 |
|
|
|
214 |
|
|
|
215 |
In theory, most of the file will have been translated, and |
|
|
216 |
anything that's untranslatable will be highlighted in red |
|
|
217 |
(TeX mode). In theory, LyX will be able to read in the file, |
|
|
218 |
and to create printed documents from it, because all that |
|
|
219 |
untranslated red stuff will be passed directly back to |
|
|
220 |
LaTeX, which LyX uses as a backend. Unfortunately, reality |
|
|
221 |
doesn't always reflect theory. If __rreeLLyyXX__ crashes, |
|
|
222 |
or LyX cannot read the generated LyX file, see the |
|
|
223 |
BUGS entry elsewhere in this document or the |
|
|
224 |
''BUGS'' file. |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
Change things that are highlighted in red (TeX mode) by hand |
|
|
228 |
in LyX. |
|
|
229 |
|
|
|
230 |
|
|
|
231 |
As mentioned above, you should be able to print out the LyX |
|
|
232 |
file even without doing this. However, changing a command in |
|
|
233 |
TeX mode to the corresponding LyX object will allow you to |
|
|
234 |
take advantage of LyX's WYSIWYM |
|
|
235 |
editing. |
|
|
236 |
|
|
|
237 |
|
|
|
238 |
__rreeLLyyXX__ is not guaranteed to create a LyX file |
|
|
239 |
which generates exactly the same output as the LaTeX file, |
|
|
240 |
but it should come close. __rreellyyXX__ will generally |
|
|
241 |
err on the side of translating less to ensure that dvi or ps |
|
|
242 |
files are accurate, even though this leads to more ``evil |
|
|
243 |
red text'' and less WYSIWYM . |
|
|
244 |
|
|
|
245 |
|
|
|
246 |
PROOFREAD THE DOCUMENT !! |
|
|
247 |
|
|
|
248 |
|
|
|
249 |
I'm sure you were planning on doing this anyway, but it's |
|
|
250 |
particularly important after translating a LaTeX document. |
|
|
251 |
__rreeLLyyXX__ is, at least now, better at |
|
|
252 |
``macro-translating'' (translating the whole document) than |
|
|
253 |
``micro-translating'' (translating every little detail). For |
|
|
254 |
example, you may see extra spaces or deleted spaces. Space |
|
|
255 |
handling has improved, but it's not perfect. |
|
|
256 |
|
|
|
257 |
|
|
|
258 |
__WWhhaatt rreeLLyyXX CCaann HHaannddllee__ |
|
|
259 |
|
|
|
260 |
|
|
|
261 |
__rreeLLyyXX__ understands many LaTeX commands. It will |
|
|
262 |
translate: |
|
|
263 |
|
|
|
264 |
|
|
|
265 |
regular text, including mini-commands like ~, `', |
|
|
266 |
@, TeX, as well as accented characters |
|
|
267 |
like '{a}, and the special cases ?` and |
|
|
268 |
!` |
|
|
269 |
|
|
|
270 |
|
|
|
271 |
title commands like author, date, |
|
|
272 |
title, thanks and the abstract |
|
|
273 |
environment |
|
|
274 |
|
|
|
275 |
|
|
|
276 |
heading commands like section including starred |
|
|
277 |
commands (section*) |
|
|
278 |
|
|
|
279 |
|
|
|
280 |
Environments: quote, quotation, and verse; center, |
|
|
281 |
flushright, and flushleft |
|
|
282 |
|
|
|
283 |
|
|
|
284 |
itemize, enumerate, and description environments, and their |
|
|
285 |
item commands. Also, well-behaved nested |
|
|
286 |
lists |
|
|
287 |
|
|
|
288 |
|
|
|
289 |
cross-referencing commands: ref, pageref, |
|
|
290 |
label, and cite |
|
|
291 |
|
|
|
292 |
|
|
|
293 |
footnote and margin |
|
|
294 |
|
|
|
295 |
|
|
|
296 |
font-changing commands including em, emph, |
|
|
297 |
textit, and corresponding commands to change |
|
|
298 |
family, size, series, and shape |
|
|
299 |
|
|
|
300 |
|
|
|
301 |
input{foo} (or input{foo.blah}) and |
|
|
302 |
include{foo}. Plain TeX input command |
|
|
303 |
``input foo.tex'' is also supported. |
|
|
304 |
|
|
|
305 |
|
|
|
306 |
tabular environment, and commands that go inside it like |
|
|
307 |
hline, cline, and multicolumn |
|
|
308 |
(but see below) |
|
|
309 |
|
|
|
310 |
|
|
|
311 |
float environments table and table*, as well as |
|
|
312 |
caption commands within them |
|
|
313 |
|
|
|
314 |
|
|
|
315 |
float environments figure and figure*, as well as graphics |
|
|
316 |
inclusion commands epsf, epsffile, epsfbox, epsfxsize, |
|
|
317 |
epsfig, psfig, and includegraphics. Both the graphics and |
|
|
318 |
graphicx forms of includegraphics are supported. Note, |
|
|
319 |
however, that many figures will not be translatable into |
|
|
320 |
LyX. See the section on ``What LyX Can't Handle'' |
|
|
321 |
below. |
|
|
322 |
|
|
|
323 |
|
|
|
324 |
thebibliography environment and bibitem command, as |
|
|
325 |
well as BibTeX's bibliography and |
|
|
326 |
bibliographystyle commands |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
miscellaneous commands: hfill, \, |
|
|
330 |
noindent, ldots... |
|
|
331 |
|
|
|
332 |
|
|
|
333 |
documentclass-specific environments (and some commands) |
|
|
334 |
which can be translated to LyX layouts |
|
|
335 |
|
|
|
336 |
|
|
|
337 |
arguments to certain untranslatable commands (e.g. |
|
|
338 |
mbox) |
|
|
339 |
|
|
|
340 |
|
|
|
341 |
Some of this support may not be 100% yet. See below for |
|
|
342 |
details |
|
|
343 |
|
|
|
344 |
|
|
|
345 |
__rreeLLyyXX__ copies math (almost) verbatim from your |
|
|
346 |
LaTeX file. Luckily, LyX reads in LaTeX math, so (almost) |
|
|
347 |
any math which is supported by LyX should work just fine. A |
|
|
348 |
few math commands which are not supported by LyX will be |
|
|
349 |
replaced with their equivalents, e.g., to is |
|
|
350 |
converted to rightarrow. See the section on |
|
|
351 |
''Syntax Files'' for more details. |
|
|
352 |
|
|
|
353 |
|
|
|
354 |
__rreeLLyyXX__ will also copy any preamble commands |
|
|
355 |
(i.e., anything before begin{document}) verbatim, |
|
|
356 |
so fancy stuff you've got in your preamble should be |
|
|
357 |
conserved in dvi and printed documents, although it will not |
|
|
358 |
of course show up in the LyX window. Check Layout- |
|
|
359 |
|
|
|
360 |
|
|
|
361 |
__WWhhaatt rreeLLyyXX CCaann''tt HHaannddllee ------ BBuutt |
|
|
362 |
iitt''ss OOKK__ |
|
|
363 |
|
|
|
364 |
|
|
|
365 |
tabular* tables |
|
|
366 |
|
|
|
367 |
|
|
|
368 |
minipages |
|
|
369 |
|
|
|
370 |
|
|
|
371 |
spacing commands (vspace, pagebreak, |
|
|
372 |
par, ...) |
|
|
373 |
|
|
|
374 |
|
|
|
375 |
centering, raggedleft, |
|
|
376 |
raggedright |
|
|
377 |
|
|
|
378 |
|
|
|
379 |
verb and verbatim environment. __rreeLLyyXX__ is |
|
|
380 |
careful to copy ''exactly'' in this case, including |
|
|
381 |
comments and whitespace. |
|
|
382 |
|
|
|
383 |
|
|
|
384 |
some unknown (e.g., user-defined) environments and |
|
|
385 |
commands |
|
|
386 |
|
|
|
387 |
|
|
|
388 |
__rreeLLyyXX__ copies unknown commands, along with their |
|
|
389 |
arguments, verbatim into the LyX file. Also, if it sees a |
|
|
390 |
begin{foo} where it doesn't recognize the ``foo'' |
|
|
391 |
environment, it will copy verbatim until it sees |
|
|
392 |
end{foo} (unless you use the __--rr__ option). |
|
|
393 |
Hopefully, then, most of these unknown commands won't cause |
|
|
394 |
__rreeLLyyXX__ to break; they'll merely require you to do |
|
|
395 |
some editing once you've loaded the file up in LyX. That |
|
|
396 |
should be less painful than editing either the .tex or the |
|
|
397 |
.lyx file using a text editor. |
|
|
398 |
|
|
|
399 |
|
|
|
400 |
__WWhhaatt rreeLLyyXX HHaannddlleess BBaaddllyy ------ |
|
|
401 |
aakkaa BBUUGGSS__ |
|
|
402 |
|
|
|
403 |
|
|
|
404 |
Since __rreeLLyyXX__ is relatively new, it's got a number |
|
|
405 |
of problems. As it matures, these bugs will be |
|
|
406 |
squished. |
|
|
407 |
|
|
|
408 |
|
|
|
409 |
If __rreeLLyyXX__ is choking on something, or LyX can't |
|
|
410 |
read it after __rreeLLyyXX__ translates it, the best |
|
|
411 |
thing to do is to put begin{reLyXskip} before the |
|
|
412 |
offending text, and end{reLyXskip} after it. I call |
|
|
413 |
this a ``skip'' block. __rreeLLyyXX__ will copy this |
|
|
414 |
block exactly, in TeX mode. Then edit the resulting LyX |
|
|
415 |
file, and translate the unknown stuff by hand. The reLyXskip |
|
|
416 |
environment is magical; the begin and end |
|
|
417 |
commands will not be put into the LyX file. |
|
|
418 |
|
|
|
419 |
|
|
|
420 |
``Exact'' copying of unknown environments and commands isn't |
|
|
421 |
quite exact. Specifically, newlines and comments may be |
|
|
422 |
lost. This will yield ugly LyX, but in almost all cases the |
|
|
423 |
output will be the same. However, certain parts of the file |
|
|
424 |
will be copied perfectly, including whitespace and comments. |
|
|
425 |
This includes: the LaTeX preamble, verbatim environments and |
|
|
426 |
verb commands, and skip blocks. |
|
|
427 |
|
|
|
428 |
|
|
|
429 |
__rreeLLyyXX__ translates only a few options to the |
|
|
430 |
documentclass command. (Specifically 1[[012]pt, |
|
|
431 |
[[letterlegalexecutivea4a5b5]paper, [[onetwo]side, landscape, |
|
|
432 |
and [[onetwo]column.) Other options are placed in the |
|
|
433 |
``options'' field in the Layout- |
|
|
434 |
|
|
|
435 |
|
|
|
436 |
More importantly, __rreeLLyyXX__ doesn't translate |
|
|
437 |
usepackage commands, margin commands, |
|
|
438 |
newcommands, or, in fact, anything else from the |
|
|
439 |
preamble. It simply copies them into the LaTeX preamble. If |
|
|
440 |
you have margin commands in your preamble, then the LyX file |
|
|
441 |
will generate the right margins. However, these margins will |
|
|
442 |
override any margins you set in the LyX Layout- |
|
|
443 |
inputencoding, |
|
|
444 |
pagestyle, etc. |
|
|
445 |
|
|
|
446 |
|
|
|
447 |
The foil class has a couple bugs. __rreeLLyyXX__ may do |
|
|
448 |
weird things with optional arguments to foilhead |
|
|
449 |
commands. Also, it may handle begin{dinglist} |
|
|
450 |
incorrectly (although the stuff in the environment should |
|
|
451 |
translate normally). |
|
|
452 |
|
|
|
453 |
|
|
|
454 |
Less significant bugs can be found in the |
|
|
455 |
''BUGS'' file. |
|
|
456 |
|
|
|
457 |
|
|
|
458 |
__rreeLLyyXX__ is hopefully rather robust. As mentioned |
|
|
459 |
above, it may not translate your file perfectly, but it |
|
|
460 |
shouldn't crash. If it does crash---and the problem is not |
|
|
461 |
one of those mentioned above or in the |
|
|
462 |
''BUGS'' file---see the section on ''Bug |
|
|
463 |
Reports''. |
|
|
464 |
|
|
|
465 |
|
|
|
466 |
__WWhhaatt LLyyXX CCaann''tt HHaannddllee__ |
|
|
467 |
|
|
|
468 |
|
|
|
469 |
LyX itself is missing a couple features, such that even if |
|
|
470 |
__rreeLLyyXX__ translates things perfectly, LyX may still |
|
|
471 |
have trouble reading it. If you really need these features, |
|
|
472 |
you can export your final document as LaTeX, and put them |
|
|
473 |
back in. See ''BUGS'' for more details on |
|
|
474 |
these bugs. |
|
|
475 |
|
|
|
476 |
|
|
|
477 |
For a number of commands, LyX does not support the optional |
|
|
478 |
argument. Examples include chapter (and other |
|
|
479 |
sectioning commands), and \. __rreeLLyyXX__ will |
|
|
480 |
automatically discard the optional arguments with a warning |
|
|
481 |
to stdout. LyX also ignores the width argument for the |
|
|
482 |
thebibliography environment. |
|
|
483 |
|
|
|
484 |
|
|
|
485 |
Centering (or right or left justifying) works on full |
|
|
486 |
paragraphs. |
|
|
487 |
|
|
|
488 |
|
|
|
489 |
LyX support for tables isn't perfect. For complicated |
|
|
490 |
tables, use a ``skip'' block, so that they will be copied in |
|
|
491 |
TeX mode. |
|
|
492 |
|
|
|
493 |
|
|
|
494 |
The LyX math editor can't handle the AMS |
|
|
495 |
-LaTeX math environments align, split, etc. So those |
|
|
496 |
environments will be copied in TeX mode. You can change |
|
|
497 |
equation* environments to the exactly equivalent |
|
|
498 |
displaymath, and then they will be translated |
|
|
499 |
correctly. |
|
|
500 |
|
|
|
501 |
|
|
|
502 |
Lyx does not support clipping or bounding boxes for included |
|
|
503 |
graphics files. Therefore, many graphics inclusion commands |
|
|
504 |
will be untranslatable, and copied in TeX mode. In certain |
|
|
505 |
cases, you might be able to translate the command by hand |
|
|
506 |
within LyX---for example, if you included a bounding box but |
|
|
507 |
the bounding box is already in the .eps file. |
|
|
508 |
|
|
|
509 |
|
|
|
510 |
LyX only allows figures to have sizes in in,cm, or |
|
|
511 |
percentages of textwidth or textheight (or columnwidth). |
|
|
512 |
__rreeLLyyXX__ will translate from other units, like pt |
|
|
513 |
or mm, but it cannot translate other lengths (e.g. if you |
|
|
514 |
wanted to scale a figure to size topmargin for some reason). |
|
|
515 |
__rreeLLyyXX__ will copy figures with untranslatable |
|
|
516 |
sizes in TeX mode. Again, you might be able to fix that |
|
|
517 |
within LyX. |
|
|
518 |
|
|
|
519 |
|
|
|
520 |
__TThhee FFuuttuurree ooff rreeLLyyXX__ |
|
|
521 |
|
|
|
522 |
|
|
|
523 |
In the future, more commands and environments will be |
|
|
524 |
supported by __rreeLLyyXX__. Bugs will be |
|
|
525 |
eradicated. |
|
|
526 |
|
|
|
527 |
|
|
|
528 |
See the TODO file for details. |
|
|
529 |
!!E EX XA AM MP PL LE ES S |
|
|
530 |
|
|
|
531 |
|
|
|
532 |
reLyX __--ddff --oo__ ``my/dir'' __--rr__ ``myenv'' |
|
|
533 |
foo.tex __ |
|
|
534 |
|
|
|
535 |
|
|
|
536 |
The above will create a file my/dir/foo.lyx from foo.tex, |
|
|
537 |
overwriting if necessary. When it finds a begin{myenv} |
|
|
538 |
... end{myenv} block, it will translate the stuff |
|
|
539 |
within the block, but copy the begin and |
|
|
540 |
end commands in TeX mode. Finally, I'm going to |
|
|
541 |
keep the temporary files around (they will also be in |
|
|
542 |
my/dir/) and output lots of debugging information into the |
|
|
543 |
file foo.debug. |
|
|
544 |
|
|
|
545 |
|
|
|
546 |
reLyX __--nn --cc__ ``literate-article'' |
|
|
547 |
foo.tex |
|
|
548 |
|
|
|
549 |
|
|
|
550 |
The above will change a noweb document into a LyX |
|
|
551 |
literate-article document. A user would do this if the noweb |
|
|
552 |
document had documentclass article. |
|
|
553 |
!!N NO OT TE ES S |
|
|
554 |
|
|
|
555 |
|
|
|
556 |
__BBuugg RReeppoorrttss__ |
|
|
557 |
|
|
|
558 |
|
|
|
559 |
If __rreeLLyyXX__ is crashing or otherwise acting |
|
|
560 |
strangely---in ways other than those described in the |
|
|
561 |
section on ''BUGS'' or the |
|
|
562 |
''BUGS'' file---then please run |
|
|
563 |
__rreeLLyyXX --dd__. That will allow you to figure out |
|
|
564 |
where in the reLyXing process it crashed. That, in turn, |
|
|
565 |
will allow you to write a better bug report, which will |
|
|
566 |
allow the developers to fix it more quickly and |
|
|
567 |
easily. |
|
|
568 |
|
|
|
569 |
|
|
|
570 |
Bug reports should be sent to the LyX developers' mailing |
|
|
571 |
list. Its address is currently lyx-devel@lists.lyx.org, but |
|
|
572 |
you can check the LyX home page, http://www.lyx.org if that |
|
|
573 |
bounces. If you are running __rreeLLyyXX__ on a huge |
|
|
574 |
file, please do not send all of the output in your bug |
|
|
575 |
report. Just include the last ten or twenty lines of output, |
|
|
576 |
along with the piece of the LaTeX file it crashed on. Or, |
|
|
577 |
even better, attach a small but complete file which causes |
|
|
578 |
the same problem as your original file. |
|
|
579 |
|
|
|
580 |
|
|
|
581 |
__IImmpplleemmeennttaattiioonn |
|
|
582 |
DDeettaaiillss::__ |
|
|
583 |
|
|
|
584 |
|
|
|
585 |
__rreeLLyyXX__ makes several ``passes'' in order to |
|
|
586 |
translate a TeX file. On each pass, it creates one or two |
|
|
587 |
files. |
|
|
588 |
|
|
|
589 |
|
|
|
590 |
Pass 0 |
|
|
591 |
|
|
|
592 |
|
|
|
593 |
Before doing anything, read the syntax file (or |
|
|
594 |
files). |
|
|
595 |
|
|
|
596 |
|
|
|
597 |
Pass 1a |
|
|
598 |
|
|
|
599 |
|
|
|
600 |
Split preamble (anything before a begin{document} |
|
|
601 |
command) off the rest of the file. It saves the two pieces |
|
|
602 |
in separate files. This is necessary because there may be |
|
|
603 |
very strange stuff in a preamble. It also ignores anything |
|
|
604 |
after the end{document}, on the assumption that it |
|
|
605 |
isn't LaTeX. |
|
|
606 |
|
|
|
607 |
|
|
|
608 |
Pass 1b |
|
|
609 |
|
|
|
610 |
|
|
|
611 |
Translate the preamble. Currently, that just means |
|
|
612 |
translating the documentclass command and copying |
|
|
613 |
the rest exactly into the LyX preamble. |
|
|
614 |
|
|
|
615 |
|
|
|
616 |
Once you know what class the document is, read the LyX |
|
|
617 |
layout file for that class. |
|
|
618 |
|
|
|
619 |
|
|
|
620 |
Pass 2 |
|
|
621 |
|
|
|
622 |
|
|
|
623 |
``Clean'' the TeX file, generating slightly stricter LaTeX. |
|
|
624 |
This includes: |
|
|
625 |
|
|
|
626 |
|
|
|
627 |
Change, e.g., x^2 to the equivalent but clearer |
|
|
628 |
x^{2} |
|
|
629 |
|
|
|
630 |
|
|
|
631 |
Removing optional arguments that LyX can't handle (e.g., |
|
|
632 |
from chapter) |
|
|
633 |
|
|
|
634 |
|
|
|
635 |
Changing {em foo} to emph{foo}, etc. This |
|
|
636 |
is necessary because LyX always writes out the non-local |
|
|
637 |
forms anyway. This should very rarely make a |
|
|
638 |
difference. |
|
|
639 |
|
|
|
640 |
|
|
|
641 |
Pass 3 |
|
|
642 |
|
|
|
643 |
|
|
|
644 |
Translate LaTeX text, commands, and environments to |
|
|
645 |
LyX. |
|
|
646 |
|
|
|
647 |
|
|
|
648 |
Pass 4 |
|
|
649 |
|
|
|
650 |
|
|
|
651 |
Put the two pieces back together, and do some final |
|
|
652 |
tweaking, to generate the LyX file |
|
|
653 |
|
|
|
654 |
|
|
|
655 |
If there are any input or include |
|
|
656 |
commands, __rreeLLyyXX__ will loop back to the beginning |
|
|
657 |
and translate those. It assumes that the included files are |
|
|
658 |
the same class as the main file, and that they have no |
|
|
659 |
preamble matter. (If you have an input command in |
|
|
660 |
the preamble of a file, the command will be copied exactly |
|
|
661 |
into the LaTeX preamble portion of the LyX file, so the |
|
|
662 |
included file won't be translated.) So when translating |
|
|
663 |
included files, it skips passes 0 and 1. |
|
|
664 |
|
|
|
665 |
|
|
|
666 |
If __rreeLLyyXX__ doesn't find a file you wanted to |
|
|
667 |
include, it will give a warning, but will continue to |
|
|
668 |
translate any files it does find. |
|
|
669 |
|
|
|
670 |
|
|
|
671 |
__LLaayyoouutt FFiilleess__ |
|
|
672 |
|
|
|
673 |
|
|
|
674 |
__rreeLLyyXX__ reads a LyX layout file to know how to |
|
|
675 |
handle LaTeX environments and commands which get translated |
|
|
676 |
to LyX layouts. This file will include all ``normal'' |
|
|
677 |
non-math environments (i.e., including quote and itemize, |
|
|
678 |
but not tabular, minipage, and some other fancy |
|
|
679 |
environments), and commands like section and |
|
|
680 |
title. If you want to reLyX a class that doesn't |
|
|
681 |
have an existing layout file, then you'll have to create a |
|
|
682 |
layout file. But you have to do this anyway, in order to LyX |
|
|
683 |
the file, since LyX depends on layout files to know how to |
|
|
684 |
display and process its files. Check the LyX documentation |
|
|
685 |
for help with this task (which can be hard or easy, |
|
|
686 |
depending on the class you want to create a layout file |
|
|
687 |
for.) If your class is quite similar to a class that has a |
|
|
688 |
layout file, then consider using the __--cc__ |
|
|
689 |
option. |
|
|
690 |
|
|
|
691 |
|
|
|
692 |
__SSyynnttaaxx FFiilleess__ |
|
|
693 |
|
|
|
694 |
|
|
|
695 |
__rreeLLyyXX__ always reads at least one syntax file, |
|
|
696 |
called the default syntax file. __rreeLLyyXX__ will read |
|
|
697 |
your personal syntax file if it exists; otherwise it will |
|
|
698 |
read the system-wide file. __rreeLLyyXX__ will read |
|
|
699 |
additional syntax files if you specify them with the |
|
|
700 |
__--ss__ option. (These extra files should have the same |
|
|
701 |
format as the default file, but will tend to be shorter, |
|
|
702 |
since they only have to specify extra commands not found in |
|
|
703 |
the default file.) A syntax file tells __rreeLLyyXX__ a |
|
|
704 |
few things. |
|
|
705 |
|
|
|
706 |
|
|
|
707 |
First, it describes the syntax of each command, that is, how |
|
|
708 |
many required arguments and how many optional arguments the |
|
|
709 |
command takes. Knowing this makes it easier for |
|
|
710 |
__rreeLLyyXX__ to copy (in TeX mode) commands that it |
|
|
711 |
doesn't know how to translate. The syntax file simply has a |
|
|
712 |
command, followed by braces or brackets describing its |
|
|
713 |
arguments in the correct order. For example, a syntax file |
|
|
714 |
entry bibitem[[]{} means that the bibitem |
|
|
715 |
command takes an optional argument followed by a required |
|
|
716 |
one, while the entry bf means that the bf |
|
|
717 |
command takes no arguments at all. When __rreeLLyyXX__ |
|
|
718 |
encounters a token that it doesn't know how to translate |
|
|
719 |
into LyX, it will copy the token---along with the correct |
|
|
720 |
number of arguments---exactly. If the token is not in the |
|
|
721 |
syntax file, then __rreeLLyyXX__ just copies as many |
|
|
722 |
arguments as it finds. This means that it may copy too much. |
|
|
723 |
But since the user can specify additional syntax files, that |
|
|
724 |
shouldn't happen often. |
|
|
725 |
|
|
|
726 |
|
|
|
727 |
Some commands that cannot be translated to LyX, like |
|
|
728 |
mbox, have as one of their arguments regular LaTeX |
|
|
729 |
text. If the string ``translate'' is put into an argument of |
|
|
730 |
an (untranslatable) command in the syntax file, then |
|
|
731 |
__rreeLLyyXX__ will translate that argument instead of |
|
|
732 |
copying it verbatim. So, for example, the default syntax |
|
|
733 |
file has raisebox{}[[][[]{translate}. This means that |
|
|
734 |
the raisebox command and the first argument (and |
|
|
735 |
optional arguments if they exist) are copied in TeX mode, |
|
|
736 |
but the last argument (which may contain math, complicated |
|
|
737 |
LaTeX, other untranslatable commands, etc.) will be |
|
|
738 |
translated into LyX. You can't use ``translate'' on optional |
|
|
739 |
arguments. |
|
|
740 |
|
|
|
741 |
|
|
|
742 |
User-defined syntax files are allowed to define new commands |
|
|
743 |
and their syntax, or override the number of arguments for a |
|
|
744 |
command given in the default syntax file. (E.g., if you're |
|
|
745 |
using a style that gives an extra argument to some |
|
|
746 |
command...) However, this will only be useful for commands |
|
|
747 |
copied in TeX mode. Commands which are actually translated |
|
|
748 |
by __rreeLLyyXX__ (like item) have their |
|
|
749 |
argument syntax hard-coded. The hard-coded commands are |
|
|
750 |
identified in the default syntax file. |
|
|
751 |
|
|
|
752 |
|
|
|
753 |
Second, the syntax file describes any ``regular |
|
|
754 |
environments''. Usually, an entire unknown environment will |
|
|
755 |
be copied in TeX mode. If you define a regular environment |
|
|
756 |
``foo'', though, then only the begin{foo} and |
|
|
757 |
end{foo} commands will be copied in TeX mode; the |
|
|
758 |
text within the environment will be treated (i.e., |
|
|
759 |
translated) by __rreeLLyyXX__ as regular LaTeX, rather |
|
|
760 |
than being copied into TeX mode. Don't try to declare |
|
|
761 |
``tabbing'' and ``picture'' as regular environments, as the |
|
|
762 |
text within those environments will confuse |
|
|
763 |
__rreeLLyyXX__; use this capability for new environments |
|
|
764 |
you create that have plain text or math or simple commands |
|
|
765 |
in them. You also can't declare unknown math environments |
|
|
766 |
(like equation*) as regular environments, either, since the |
|
|
767 |
LyX math editor won't understand them. The names of regular |
|
|
768 |
environments appear, whitespace-separated, between |
|
|
769 |
begin{reLyXre} and end{reLyXre} statements |
|
|
770 |
in the syntax file. (If you have a regular environment which |
|
|
771 |
you won't use very often, you can use the __--rr__ option |
|
|
772 |
rather than writing a syntax file.) |
|
|
773 |
|
|
|
774 |
|
|
|
775 |
Third, the syntax file describes a math translation table. |
|
|
776 |
The LyX math editor doesn't support a few commands. For |
|
|
777 |
example, _ is supported, but the equivalent |
|
|
778 |
sb is not. Put any commands you'd like translate |
|
|
779 |
between begin{reLyXmt} and end{reLyXmt} |
|
|
780 |
statements. The statement ``\ {Vert}'' means that |
|
|
781 |
any \ in math mode will be converted to |
|
|
782 |
``Vert '' (in cases where a token made up of a |
|
|
783 |
backslash and a non-letter is translated to something with |
|
|
784 |
letters at the end, a space is added by __rreeLLyyXX__. |
|
|
785 |
That way, ``a'' is correctly translated to |
|
|
786 |
``Vert a |
|
|
787 |
|
|
|
788 |
|
|
|
789 |
__MMiisscceellllaanneeoouuss__ |
|
|
790 |
|
|
|
791 |
|
|
|
792 |
You need Perl version 5.002 or later to run |
|
|
793 |
__rreeLLyyXX__. |
|
|
794 |
__ |
|
|
795 |
!!D DI IA AG GN NO OS ST TI IC CS S |
|
|
796 |
|
|
|
797 |
|
|
|
798 |
__rreeLLyyXX__ should always explain why it crashes, if |
|
|
799 |
it crashes. Some diagnostics may be very technical, though, |
|
|
800 |
if they come from the guts of the code. __rreeLLyyXX__ |
|
|
801 |
gives much more information while running if you use the |
|
|
802 |
__--dd__ option, but you shouldn't need that unless |
|
|
803 |
something goes wrong. |
|
|
804 |
|
|
|
805 |
|
|
|
806 |
When it's finished, __rreeLLyyXX__ will tell you if it |
|
|
807 |
finished successfully or died due to some |
|
|
808 |
error. |
|
|
809 |
!!W WA AR RN NI IN NG GS S |
|
|
810 |
|
|
|
811 |
|
|
|
812 |
Always keep a copy of your original LaTeX files either under |
|
|
813 |
a different name or in a different directory. There are a |
|
|
814 |
couple ways in which using LyX could lead to overwriting the |
|
|
815 |
original LaTeX file. |
|
|
816 |
|
|
|
817 |
|
|
|
818 |
If you import foo.tex to create foo.lyx, then edit foo.lyx |
|
|
819 |
and want to re-export it, note that it will overwrite the |
|
|
820 |
original foo.tex. (LyX will ask you if you want to overwrite |
|
|
821 |
it.) |
|
|
822 |
|
|
|
823 |
|
|
|
824 |
If you have the use_tempdir variable set to false in your |
|
|
825 |
lyxrc, then LyX will create its temporary files in your |
|
|
826 |
current directory, which means your LaTeX original may be |
|
|
827 |
overwritten (without a warning from LyX) when you ``view |
|
|
828 |
dvi'' or print the LyX document. |
|
|
829 |
!!F FI IL LE ES S |
|
|
830 |
|
|
|
831 |
|
|
|
832 |
''MY_LYXDIR'' |
|
|
833 |
/layouts/*.layout |
|
|
834 |
|
|
|
835 |
|
|
|
836 |
User's personal layout files for document |
|
|
837 |
classes |
|
|
838 |
|
|
|
839 |
|
|
|
840 |
''MY_LYXDIR'' |
|
|
841 |
/reLyX/syntax.default |
|
|
842 |
|
|
|
843 |
|
|
|
844 |
User's personal syntax file |
|
|
845 |
|
|
|
846 |
|
|
|
847 |
''LIBDIR'' /layouts/*.layout |
|
|
848 |
|
|
|
849 |
|
|
|
850 |
System-wide layout files for document classes |
|
|
851 |
|
|
|
852 |
|
|
|
853 |
''LIBDIR'' |
|
|
854 |
/reLyX/syntax.default |
|
|
855 |
|
|
|
856 |
|
|
|
857 |
System-wide LaTeX syntax file |
|
|
858 |
|
|
|
859 |
|
|
|
860 |
''LIBDIR'' is the system-wide LyX |
|
|
861 |
directory, usually something like /usr/local/share/lyx/. |
|
|
862 |
''MY_LYXDIR'' is your personal LyX |
|
|
863 |
directory, something like .lyx/ in your home |
|
|
864 |
directory. |
|
|
865 |
!!S SE EE E A AL LS SO O |
|
|
866 |
|
|
|
867 |
|
|
|
868 |
lyx(1), latex(1) |
|
|
869 |
!!A AU UT TH HO OR RS S |
|
|
870 |
|
|
|
871 |
|
|
|
872 |
Copyright (c) 1998-9 Amir Karger |
|
|
873 |
(karger@post.harvard.edu) |
|
|
874 |
|
|
|
875 |
|
|
|
876 |
Code contributors: |
|
|
877 |
|
|
|
878 |
|
|
|
879 |
John Weiss wrote the original CleanTeX pass. |
|
|
880 |
|
|
|
881 |
|
|
|
882 |
Etienne Grossmann |
|
|
883 |
|
|
|
884 |
|
|
|
885 |
Jose Abilio Oliveira Matos |
|
|
886 |
|
|
|
887 |
|
|
|
888 |
David Suarez de Lis |
|
|
889 |
|
|
|
890 |
|
|
|
891 |
Kayvan Aghaiepour Sylvan added noweb stuff and wrote |
|
|
892 |
noweb2lyx |
|
|
893 |
|
|
|
894 |
|
|
|
895 |
Other contributors: |
|
|
896 |
|
|
|
897 |
|
|
|
898 |
Jean-Marc Lasgouttes worked on the wrapper script and |
|
|
899 |
offered lots of bug reports, advice, and feature |
|
|
900 |
suggestions. |
|
|
901 |
|
|
|
902 |
|
|
|
903 |
Asger K. Alstrup Nielsen and Marc Pavese provided |
|
|
904 |
advice. |
|
|
905 |
|
|
|
906 |
|
|
|
907 |
Various members of the LyX developers' and users' lists |
|
|
908 |
provided bug reports and feature suggestions. |
|
|
909 |
|
|
|
910 |
|
|
|
911 |
__rreeLLyyXX__ uses a modified version the Perl TeX |
|
|
912 |
parser Text::TeX package written by Ilya Zakharevich |
|
|
913 |
(ilya@math.ohio-state.edu), available on CPAN |
|
|
914 |
. |
|
|
915 |
---- |