Importación y exportación de archivos LyX con entornos AMS

Importación y exportación de archivos LyX con entornos AMS

Tengo problemas para convertir archivos LyX que usan entornos AMS entre el formato .lyx y el formato .tex. Para ver lo que quiero decir, aquí hay un ejemplo mínimo.

Comenzando con el siguiente archivo LyX sin formato:

#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

Utilicé Archivo > Exportar > LaTeX (normal) para generar el siguiente archivo .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}

Hasta ahora, todo bien, ya que ambos archivos se compilan en el mismo archivo .pdf. Desafortunadamente, cuando intento importar el archivo .tex nuevamente a LyX, el entorno AMS desaparece y me queda algo de ERT:

ingrese la descripción de la imagen aquí

Y al intentar compilar en LyX, aparece el error:

! LaTeX Error: Environment defn undefined.

Parece que durante el proceso de importación, se eliminaron las siguientes líneas:

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

Intentar volver a colocar este código en el preámbulo da como resultado un error de "Secuencia de control no definida".

¿Se espera este comportamiento para LyX 2.2.3 o me he perdido algo aquí? Si es posible, me gustaría conservar todos los entornos de AMS durante todo el proceso de conversión.

¡Gracias de antemano!

información relacionada