[Tex/LaTex] How to import latex files into LyX

importlyx

I am new to LyX and trying to import the Latex file:

\documentclass{article}
\begin{document}
This is a Latex document.
\end{document}

I get the error

An error occurred while running tex2lyx2.3-f "TestLyx.tex" "TestLyx.lyx"

There was an earlier similar question that was solved by updating Lyx but I am using the latest version. This seems too simple for anything to go wrong but I must be doing something.

Best Answer

Cant really make it more mwe than that
I presume the file above was saved as TestLyx.tex and not in an unusual folder path.

Presumably in a documents folder under your user name, and that user name does NOT have accents spaces or other non-latin characters)

Lyx needs to be installed correctly such that using the tools check tex it confirms all is well with TeX.

You selected File Import LaTeX (plain) and it should have shown as

enter image description here

The message as shown should be Importing .......tex2lyx -f "TextLyx.tex" "TextLyx.lyx"

NOTE you either have a typo or there is something drastically wrong since there should be a space between tex2lyx and -f

Use view messages pane to check there is a space if no space you need to consult Lyx support
Proceeding on the basis it's a typo within your question and there is a space, then why do you get
An error occurred …

The most likely culprits are
1) something bad in the tex file, unlikely but not impossible so ensure it is a very simple cut and past file (as I did with notepad)
2) file is on a bad path (please include such detail in your question)
3) tex2lyx is on a bad path
go to a cmd prompt (use any means but avoid starting within the LyX folders) and run

>where $path:tex2lyx
>where /r \ tex2lyx

Confirm both are exactly the same answer especially the path before tex2lyx Tell us what those paths are (just the once)

However I can tell you even after a week of trying hangul characters may not work and had to resort to a fresh user account.

Related Question