LyXProblems with importing TeX documents with math environments

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
domherre
Posts: 1
Joined: Fri Feb 04, 2011 5:52 pm

Problems with importing TeX documents with math environments

Post by domherre »

I am using Lyx 1.6.7.
Problem: I cannot seem to import a .tex document containing theorem or definition environments.

To reproduce the problem:
1. Start a new empty lyx document add any ams math module.
2. Create a theorem in it an export to .tex
3. Import the .tex

Now Lyx will not recognize the envoirment and the document will contain tex code such as \begin{thm}. The problem is even after adding the ams math module, lyx refuses to compile the document.

"\begin{thm} Test \end{thm} \begin{proof} test \end{proof}
Your command was ignored.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

roberthannah89
Posts: 6
Joined: Thu Apr 28, 2016 9:56 pm

Re: Problems with importing TeX documents with math environm

Post by roberthannah89 »

I'm having the exact same problem in LyX version 2.2.1. Would really appreciate a solution.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Problems with importing TeX documents with math environments

Post by Stefan Kottwitz »

It seems you need to explicitly load the amsthm package, such as in the document preamble:

\usepackage{amsthm}

Stefan
LaTeX.org admin
roberthannah89
Posts: 6
Joined: Thu Apr 28, 2016 9:56 pm

Re: Problems with importing TeX documents with math environm

Post by roberthannah89 »

Yes i did this. I loaded amsthm in the preamble. It still does not work for some reason.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Problems with importing TeX documents with math environm

Post by Stefan Kottwitz »

Then please post the exact error message. Even better would be the .log file, as attachment here.

Stefan
LaTeX.org admin
roberthannah89
Posts: 6
Joined: Thu Apr 28, 2016 9:56 pm

Problems with importing TeX documents with math environments

Post by roberthannah89 »

I guess my problem is slightly different. It will still compile, but the theorem environments are not recognised by LyX.

So as an example document:

Code: Select all

\documentclass{article}
\usepackage{amsthm}

\newtheorem{thm}{Theorem}

\begin{document}
Test

\begin{thm}
Test theorem.
\end{thm}
\end{document}
I imported this into LyX. It compiles but "\begin{theorem}" and "\end{theorem}" are in red boxes.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Problems with importing TeX documents with math environm

Post by Stefan Kottwitz »

And what about the .log file?

Stefan
LaTeX.org admin
roberthannah89
Posts: 6
Joined: Thu Apr 28, 2016 9:56 pm

Problems with importing TeX documents with math environments

Post by roberthannah89 »

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2016.9.9) 13 OCT 2016 14:05
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.

("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\inputenc.sty"
Package: inputenc 2015/03/17 v1.2c Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15
("C:\Program Files\MiKTeX 2.9\tex\latex\base\latin9.def"
File: latin9.def 2015/03/17 v1.2c Input encoding file
)) ("C:\Program Files\MiKTeX 2.9\tex\latex\amscls\amsthm.sty"
Package: amsthm 2015/03/04 v2.20.2
\thm@style=\toks16
\thm@bodyfont=\toks17
\thm@headfont=\toks18
\thm@notefont=\toks19
\thm@headpunct=\toks20
\thm@preskip=\skip43
\thm@postskip=\skip44
\thm@headsep=\skip45
\dth@everypar=\toks21
)
\c@thm=\count87
(test.aux)
\openout1 = `test.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 19.
LaTeX Font Info: ... okay on input line 19.
[1

{C:/Users/Rober/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}] (test.aux)
)
Here is how much of TeX's memory you used:
349 strings out of 493334
3919 string characters out of 3139253
54334 words of memory out of 3000000
3952 multiletter control sequences out of 15000+200000
4294 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
23i,4n,17p,143b,119s stack positions out of 5000i,500n,10000p,200000b,50000s
<C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmbx10.pfb><C:/Pro
gram Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb><C:/Program File
s/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on test.pdf (1 page, 32549 bytes).
PDF statistics:
18 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: Problems with importing TeX documents with math environm

Post by Stefan Kottwitz »

Ok, I don't see any problem. If there's a red box, don't know what cosmetic thing it is, as it compiles, and there's no actual issue mentioned.

Stefan
LaTeX.org admin
roberthannah89
Posts: 6
Joined: Thu Apr 28, 2016 9:56 pm

Re: Problems with importing TeX documents with math environm

Post by roberthannah89 »

Well the issue for me is that the document is now hard to read, much like a .tex source file. Theorem environments are possible in LyX, but they are not recognised.
Post Reply