Secuencia de control indefinida de LyX \entrada

Secuencia de control indefinida de LyX \entrada

Soy un nuevo usuario. Tengo problemas con lyX y, en particular, con cómo usarlo \input{file.tex}correctamente. Error: "secuencia de control no definida". En realidad no estoy seguro de dónde tengo que especificar la ruta para que LyX pueda reconocerla y encontrarla. Hasta ahora usé Insertar > flotante > tabla (aquí es donde voy a agregar 2 tablas diferentes). En el preámbulo de LateX (Documento > Configuración > Preámbulo de LateX) estoy usando lo siguiente:

% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{threeparttablex}% For Notes below table

% *****************************************************************
% siunitx
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}} 

\usepackage{siunitx}
    \sisetup{
        detect-mode,
        group-digits            = false,
        input-symbols           = ( ) [ ] - +,
        table-align-text-post   = false,
        input-signs             = ,
        }   

% Character substitution that prints brackets and the minus symbol in text mode. Thanks to David Carlisle
\def\yyy{%
  \bgroup\uccode`\~\expandafter`\string-%
  \uppercase{\egroup\edef~{\noexpand\text{\llap{\textendash}\relax}}}%
  \mathcode\expandafter`\string-"8000 }

\def\xxxl#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\llap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\xxxr#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\rlap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\textsymbols{\xxxl[\xxxr]\xxxl(\xxxr)\yyy}


% *****************************************************************
% Estout related things
% *****************************************************************
\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estwide}[3]{
        \vspace{.75ex}{
            \textsymbols% Note the added command here
            \begin{tabular*}
            {\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular*}
            }
        }   

\newcommand{\estauto}[3]{
        \vspace{.75ex}{
            \textsymbols% Note the added command here
            \begin{tabular}{l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular}
            }
        }

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
    \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}
}

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
% The new approach using threeparttables to generate notes that are the exact width of the table.
\newcommand{\Figtext}[1]{%
    \begin{tablenotes}[para,flushleft]
    \hspace{6pt}
    \hangindent=1.75em
    #1
    \end{tablenotes}
    }
\newcommand{\Fignote}[1]{\Figtext{\emph{Note:~}~#1}}
\newcommand{\Figsource}[1]{\Figtext{\emph{Source:~}~#1}}
\newcommand{\Starnote}{\Figtext{* p < 0.1, ** p < 0.05, *** p < 0.01. Standard errors in parentheses.}}% Add significance note with \starnote

¡Aprecio tu apoyo! ¡Gracias!

Respuesta1

El comando \input{}debería funcionar en un nuevo archivo LyX sin preámbulo de usuario, así como con su preámbulo. Pruebe esto en el cuerpo del documento:

  1. Ctrl+L(Esto crea un cuadro ERT - texto rojo malvado -)
  2. Escribe dentro del cuadro ERT \input{/your/path/here/file}(puedes omitir la .texextensión) o simplemente \input{file} cuando el documento secundario esté en el mismo directorio que el documento principal.

Puedes obtener el mismo resultado con el menú en Insert > File > Children document(o algo así, no puedo comprobar las etiquetas exactas en inglés). El resultado es el mismo, la única diferencia es que en lugar del código LaTeX que LyX simplemente ignora, verá un cuadro gris en el que se puede hacer clic y que se puede cambiar a través de una ventana de Lyx:

MWE

Si tiene un error de "secuencia de control no definida", debería deberse a algún comando infractor en el documento secundario. Tenga en cuenta que file.texdebe ser solo una parte del cuerpo del documento, no un documento LaTeX completo. Primero verifique que \input{}funcione bien con algún texto simple (un " Hello, Word!" es suficiente) o una tabla simple como esta:

\begin{tabular}{|l|l|l|}
\hline
    11 & 12 & 13\\
    21 & 22 & 23\\
    31 & 32 & 33\\
\hline
\end{tabular}

información relacionada