ASL クラス ファイルと cleveref および cite パッケージ間の衝突

ASL クラス ファイルと cleveref および cite パッケージ間の衝突

私は論文を提出したいのですが記号論理学ジャーナルつまり、私は記号論理学協会のクラスファイルasl.clsと参考文献スタイルファイルを使用する必要がありasl.bst、どちらも入手可能である。ここ

これまで、、およびパッケージをhyperref、およびドキュメント クラスの両方と一緒に使用してきました。しかし、クラス ファイルが問題を引き起こしています。MWE を以下に示します。cleverefcitearticlebookasl.cls

\documentclass{asl}

\usepackage{color}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor={blue},citecolor={orange}}
%\usepackage[nameinlink]{cleveref} % If this is switched on, then the .tex file fails to compile.
\usepackage{cite} % This package doesn't lead to a catastrophic failure, but the citation appears as [?].

\newtheorem{thm}{Theorem}

\title{A minimal working example}
\author{M.W.\ Example}

\begin{document}
\maketitle

\begin{thm}\label{theorem}
There exists a solution to this \LaTeX{} problem.
\end{thm}

\begin{proof}
See the \TeX{} Stack Exchange.
\end{proof}

A reference to the theorem: \ref{theorem} This is working! :)

A citation: \cite{test} This is not working. :(

\bibliography{MWE}
\bibliographystyle{asl}

\end{document}

MWE.bib ファイルは次のとおりです。

 @article{test,
 author           = {Why, Y.O.},
 title            = {Clashes between packages and class files},
 journal          = {Journal of tricky \LaTeX{} problems},
 year             = {2017},
 volume           = {1},
 pages            = {1-101}
 }

これまでの観察と試みのいくつか:

  1. このファイルはasl.cls2002 年のものであり、一部のパッケージより古いものだと思いますが、より新しいバージョンを見つけることができませんでした。
  2. 私はファイルを調べましたasl.clsが、LaTeXクラスファイルの内部動作に関する私の知識はとても制限があり、依存関係が多すぎるため、どこから始めればよいかわかりません。
  3. パッケージをオフにするとcite、引用は [1] ([?] ではなく) として正しく表示されますが、クリックできません。
  4. などの一部の標準パッケージは、amsthmファイルに組み込まれていますasl.cls(ただし、その方法は完全には理解していません)。

hyperrefそこで、私の質問は次のとおりです。 、cleverefおよびciteパッケージを (おそらく の修正バージョン)と一緒に使用する方法はありますかasl.cls?

答え1

私はファイルを調べてasl.clsasl.bstドキュメント クラスのユーザー ガイド ( asldoc.ps) の意味を理解しようとしました。

  • ファイルのコピーを作成しasl.cls、そのコピーを と呼んでいますals-mod.cls

  • ファイルをals-mod.clsテキスト エディターで開き、の (再) 定義が始まる 3332 行目に移動します\bibliographystyle。このマクロの (再) 定義全体、つまり 3332 行目から 3349 行目をコメント アウトします。

  • メインの tex ファイルで、asl-modを の必須引数として指定し\documentclass、オプションbibotherとを指定しますotherbib(はい、この両方です)。

  • メインの tex ファイルで、 の引数を から に変更します。\bibliographystyleファイル内のコーディングは、単に許容範囲を超えています。修正しようとしても意味がありません。ドキュメント クラスのユーザー ガイドでは、間接的ではありますが、 スタイルを使用して参考文献をコンパイルしても問題ないことが示されています。ぜひ実行してください。(ユーザー ガイドには、「 以外のスタイルを使用する理由はありません」と記載されています。これは参考文献スタイルの使用を推奨しているように聞こえますが、 を使用しなければならないという指示はありません。)aslplainasl.bstaslplainaslaslasl

これらの変更により、\cite指示には実際に数値の引用の呼び出しが表示されるようになります。やったー!

  • 仕事に行くにはcleveref、必ず(a)走って\newtheorem{thm}{Theorem} 前に(b)ロードし、ロード後にcleveref指示を与える。\crefname{thm}{Theorem}{Theorems}cleveref

ここに画像の説明を入力してください

\RequirePackage{filecontents}
\begin{filecontents}{MWE.bib}
@article{test,
 author       = {Why, Y. O.},
 title        = {Clashes between packages and class files},
 journal      = {Journal of tricky \LaTeX{} problems},
 year         = {2017},
 volume       = {1},
 pages        = {1-101}
 }
\end{filecontents}

\documentclass[otherbib,bibother]{asl-mod} % not 'asl'
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks=true,
            linkcolor={blue},
            citecolor={red}}

\newtheorem{thm}{Theorem}

\usepackage[nameinlink]{cleveref} % 'nameinlink' option is optional
\crefname{thm}{Theorem}{Theorems}

\bibliographystyle{plain} % not 'asl'

\begin{document}
%\title{A minimal working example}
%\author{M.W.\ Example}
%\maketitle

\begin{thm}\label{theorem}
There exists a solution to this \LaTeX{} problem.
\end{thm}

\begin{proof}
See the \TeX{} Stack Exchange.
\end{proof}

A \verb+\cref+ cross-reference: \cref{theorem}. This is now working.

A citation call-out: \cite{test}. This now works too.

\bibliography{MWE}
\end{document}

関連情報