
私は新しいユーザーです。lyX で困っています。特に、正しい使い方が\input{file.tex}
わかりません。エラー: 「未定義の制御シーケンス」。実際のところ、LyX が認識して見つけられるようにパスをどこに指定すればよいのかわかりません。これまでは、挿入 > フロート > テーブル (ここで 2 つの異なるテーブルを追加します) を使用しました。LateX のプリアンブル (ドキュメント > 設定 > LateX プリアンブル) では、次のものを使用しています。
% 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
応援していただきありがとうございます!
答え1
このコマンドは、\input{}
ユーザー プリアンブルのない新しい LyX ファイルでも、プリアンブルがある場合でも機能するはずです。ドキュメントの本文でこれを試してください。
Ctrl+L
(これにより、ERT (邪悪な赤いテキスト ボックス) が作成されます)- 子ドキュメントがメイン ドキュメントと同じディレクトリにある場合は、ERT ボックス内に記述します
\input{/your/path/here/file}
(拡張子は省略できます.tex
) 。\input{file}
のメニューでも、同じ結果を得ることができますInsert > File > Children document
(またはそれに似たもの。正確な英語のラベルは確認できません)。結果は同じですが、唯一の違いは、LyX によって無視される LaTeX コードの代わりに、Lyx ウィンドウから変更できるクリック可能な灰色のボックスが表示されることです。
「未定義の制御シーケンス」エラーが発生した場合、原因は子ドキュメント内の問題のあるコマンドであるはずです。これはfile.tex
完全な LaTeX ドキュメントではなく、ドキュメント本体の一部分のみである必要があることに注意してください。まず、\input{}
プレーン テキスト (" " で十分) または次のような単純な表で正常に動作することを確認しますHello, Word!
。
\begin{tabular}{|l|l|l|}
\hline
11 & 12 & 13\\
21 & 22 & 23\\
31 & 32 & 33\\
\hline
\end{tabular}