Edit Links |
FAQ /
ImportExport
<< | Page list | >>
Importing and Exporting Other FormatsTable of contents (hide)
§1. How do I convert LyX files from the command line?The exact details depend upon how you can call LyX itself from the command line on your platform (try lyx --help), but if we ignore that, then what you want is: lyx --export FORMAT myfile.lyx
where FORMAT is the short identifier of the format you want to export, e.g., "dvi" for DVI files or "pdf2" to export PDF via pdflatex. (See the File Formats pane in LyX's preferences dialog for a list of the available formats.) This (--export) will create the output file in the same directory as the input file. To specify the output file and path, use --export-to , or -E e.g: lyx --export-to pdf2 c:\temp\afile.pdf afile.lyx
(win7) this results in a windows error box: "Lyx.exe has stopped working". This is avoided by using start /wait command to wait until lyx has finished. start /wait lyx --export-to pdf2 c:\temp\afile.pdf afile.lyx
§2. How do I select Branches when exporting?Often the point of exporting from the commandline is to build different variants of the document. lyx -x "command-sequence branch-activate b1; branch-deactivate b2" -E pdf2 outfile.pdf infile.lyx
§3. Can I read and write Word files?Yes, but not trivially, and you should not expect to be able to collaborate with someone using Word to edit your paper. You can import Word files, and you can export Word files, but going "roundtrip" is not workable. §3.1 How can I import Word and Libreoffice/Openoffice files?Reading Word files essentially means converting them into LaTeX and then importing that into LyX. So the real question is: How can you convert Word files into LaTeX? There are several options, and the available converters and half-measures change rapidly. Remember to search the user's mail list, for instance at [1]. All of these have limitations, however, because Word is inherently not a markup language like LyX and LaTeX. Here are some main options:
Other options include wvware (last updated 2006), which is also available from within Abiword. §3.2 How can I export Word and Libreoffice/Openoffice files?For exporting MS Word or Libreoffice / Openoffice documents, the main options are:
If LyX's configure script finds any of Pandoc, Latex2rtf or TeX4ht, it will configure the converter for you and make it available under File>Export. §4. How can I read and write HTML files?To read HTML files, use a program that converts HTML files into LaTeX, such as html2latex or gnuhtml2latex, and then import the resulting LaTeX file into LyX. For writing HTML files, there are three sorts of options:
§5. I've got TeXinfo document source. How can I convert this into LyX format ?Try texi2latex (http://savannah.nongnu.org/projects/texi2latex) §6. How can I set the length of automatic line wrapping when exporting as text (plain text, LaTeX, HTML, SGML) file?In Tools→Preferences→Output→General, adjust the value of Output line length. §6.1 What if I really do not want any line break?If you do not want any line breaks within paragraphs, set Tools→Preferences→Output→General→Output line length to 0. If you do not want any line breaks at all, use sed ':looop $!{ N s/\n/ / tloop }' your_ASCII_file.txt > a_file_with_a_single_really_long_line.txt
§7. Why does the filename of the exported .tex/ps/pdf differ from the filename of my .lyx-file?In some cases, LyX changes the file name. It does so while exporting to the temporary directory (within the View/Export process) if you have a multi-part document in order to disambiguate file names, and sometimes it does so if it thinks the given file name will not work (e.g. with your version of TeX or your system encoding). Import, Export, FAQ, Word, HTML << | FAQ.PageList | >> |