このコードをコンパイルしようとしています
\documentclass[a4paper, 11pt]{article}
\input{Preambule.tex}
\input{Commands.tex}
\begin{document}
%\maketitle
\begin{center}
\Large \WorkTitle \\
\Large \today
\end{center}
%\tableofcontents
\section{Introduction}
\figz{Pictures/mx.png}{4cm}{lab1}{Pictures/mx.png}{4cm}{lab2}{big cap}{fig:mux}
\figi{Pictures/mx.png}{8cm}{label}
\end{document}
コマンド \figz は {Commands.tex} から取得され、コマンドは次のように定義されます。
%Simple figure
\newcommand{\figi}[3]{
\begin{figure}[!ht]
\begin{center}
\includegraphics[width=#2]{#1}
\end{center}
\caption{\label{#1}#3}
\end{figure}
}
%two figures side by side
%inputs
% #1 figpath1 // #2 fig1 size // #3 labelfig1
% #4 figpath2 // #5 fig2 size // #6 labelfig2
% #7 fig lgd // #8 fig ref
\newcommand{\figz}[8]{
\begin{figure}[!ht]
\centering
\subfloat[\centering #3]{{\includegraphics[width=#2]{#1} }}%
\qquad
\subfloat[\centering #6]{{\includegraphics[width=#5]{#4} }}%
\caption{#7}%
\label{#8}%
\end{figure}
}
このコマンドをコンパイルしようとすると、必ず「未定義の制御シーケンス」というエラーが発生します。非常に奇妙なのは、いくつかの古いドキュメントでまったく同じコマンドを使用していたのに、この問題が発生したことがないことです。今日現在、それらをコンパイルできます。「Commands.tex」で定義されている \figi コマンドは、エラーを報告しません。
私は James Yu の拡張機能である LaTex Workshop を備えた VScode を使用しています。
エラーがどこから発生しているのか、何か考えはありますか?
答え1
しばらく調べた後、ファイル\usepackage{subfig}
に を含めていなかったことに気付きましたPreamble.tex
。問題は解決しました...