
Sou um novo usuário. Estou com problemas com o lyX e, em particular, com como usá-lo \input{file.tex}
corretamente. Erro: "sequência de controle indefinida". Na verdade não tenho certeza de onde devo especificar o caminho para que o LyX possa reconhecê-lo e encontrá-lo. Até agora usei Insert > float > table (é aqui que vou anexar 2 tabelas diferentes). No preâmbulo do LateX (Documento > Configurações > Preâmbulo do LateX) estou usando o seguinte:
% 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
Eu agradeço seu apoio! Obrigado!
Responder1
O comando \input{}
deve funcionar em um novo arquivo LyX sem preâmbulo do usuário, bem como com o seu preâmbulo. Tente isto no corpo do documento:
Ctrl+L
(Isso cria uma caixa ERT - texto vermelho maligno)- Escreva dentro da caixa ERT
\input{/your/path/here/file}
(pode omitir a.tex
extensão) ou simplesmente\input{file}
quando o documento filho estiver no mesmo diretório que o documento principal.
Você pode obter o mesmo resultado com o menu Insert > File > Children document
(ou algo parecido, não consigo verificar os rótulos exatos em inglês). O resultado é o mesmo, a única diferença é que em vez do código LaTeX que é simplesmente ignorado pelo LyX, você verá uma caixa cinza clicável que pode ser alterada através de uma janela do Lyx:
Se você tiver um erro de "sequência de controle indefinida", deve ser devido a algum comando incorreto no documento filho. Observe que file.tex
deve ser apenas uma parte do corpo do documento, não um documento LaTeX completo. Primeiro verifique se \input{}
funciona bem com algum texto simples (um " Hello, Word!
" é suficiente) ou uma tabela simples como esta:
\begin{tabular}{|l|l|l|}
\hline
11 & 12 & 13\\
21 & 22 & 23\\
31 & 32 & 33\\
\hline
\end{tabular}