Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I create tables in a spreadsheet program, convert them to LaTeX code and then use an ERT to import into my LyX document. When I paste the LaTeX code the entire thing turns out very ugly looking. The table, however, works fine but its impossible to edit within LyX due to the ugly formatting when pasted. Is there a way to import a LaTeX file into a table float instead of inserting an ERT in LyX?

share|improve this question
    
Try to (1) export your LyX document (including only the ERT table) to Latex (pdflatex) and then (2) to import the resulting .tex file back into LyX. If the table is not too complex and you are lucky, LyX will transform it into a LyX table that then may be Copy&Pasted to your original document and edited there with LyX's table editor. –  Daniel Feb 18 '13 at 20:32
    
@alex Is it possible posting any snapshot?, please. –  Mika Ike Apr 15 at 10:52
add comment

2 Answers 2

up vote 2 down vote accepted

If the table (LaTeX code) is saved in a file table1.tex it is possible to include it into the float (or elsewhere) in LyX by using "Insert > File > Child Document..." with "Include Type: Input".

For editing the table in file table1.tex, you can right-click on the field "Input: table1.tex" and choose "Edit Included File...". A text editor should open up displaying table1.tex.

share|improve this answer
    
If you like this way better, you might like using instant preview, which will show what the table will look like in LyX when it's rendered to PDF (if this doesn't make sense, try it to see): First make sure instant preview is turned on. Go to Tools > Display and "Instant Preview" should be "on". Then highlight the child document inset (the grey box with the tex "Include: yourfile.tex") and go to Insert > Preview. –  scottkosty Feb 19 '13 at 1:43
add comment

If it's a simple file (simple in terms of simple LaTeX. It can be as wide or as long as you want), you can use the tex2lyx program. The easiest way to do this is to go to File > Import > LaTeX (plain). Then copy that table and paste it into your main document.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.