AMS 環境での LyX ファイルのインポートとエクスポート

AMS 環境での LyX ファイルのインポートとエクスポート

AMS 環境を使用する LyX ファイルを .lyx 形式と .tex 形式の間で変換する際に問題が発生しています。私の言っていることを理解していただくために、簡単な例を示します。

次の生の LyX ファイルから始めます。

#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\begin_modules
theorems-ams-bytype
theorems-sec-bytype
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "charter" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 12
\spacing single
\use_hyperref false
\papersize letterpaper
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 0.5in
\topmargin 0.75in
\rightmargin 0.5in
\bottommargin 0.75in
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip bigskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Definition
Sample Text.
\end_layout

\end_body
\end_document

ファイル > エクスポート > LaTeX (プレーン) を使用して、次の .tex ファイルを生成しました。

%% LyX 2.2.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english]{article}
\usepackage{charter}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=0.75in,bmargin=0.75in,lmargin=0.5in,rmargin=0.5in}
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsmath}
\usepackage{amsthm}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
  \theoremstyle{definition}
  \newtheorem{defn}{\protect\definitionname}[section]

\makeatother

\usepackage{babel}
  \providecommand{\definitionname}{Definition}

\begin{document}
\begin{defn}
Sample Text.
\end{defn}

\end{document}

これまでのところ、両方のファイルが同じ .pdf ファイルにコンパイルされるので、順調です。残念ながら、.tex ファイルを LyX にインポートしようとすると、AMS 環境が消えてしまい、ERT が残ってしまいます。

ここに画像の説明を入力してください

LyX でコンパイルしようとすると、次のエラーが発生します。

! LaTeX Error: Environment defn undefined.

インポート プロセス中に、次の行が削除されたようです。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
  \theoremstyle{definition}
  \newtheorem{defn}{\protect\definitionname}[section]

このコードをプリアンブルに戻そうとすると、「未定義の制御シーケンス」エラーが発生します。

この動作は LyX 2.2.3 で想定されているものでしょうか、それとも私が何か見逃しているのでしょうか? 可能であれば、変換プロセス全体を通じてすべての AMS 環境を保持したいと思います。

前もって感謝します!

関連情報