
私は論文を提出したいのですが記号論理学ジャーナルつまり、私は記号論理学協会のクラスファイルasl.cls
と参考文献スタイルファイルを使用する必要がありasl.bst
、どちらも入手可能である。ここ。
これまで、、およびパッケージをhyperref
、およびドキュメント クラスの両方と一緒に使用してきました。しかし、クラス ファイルが問題を引き起こしています。MWE を以下に示します。cleveref
cite
article
book
asl.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}
}
これまでの観察と試みのいくつか:
- このファイルは
asl.cls
2002 年のものであり、一部のパッケージより古いものだと思いますが、より新しいバージョンを見つけることができませんでした。 - 私はファイルを調べました
asl.cls
が、LaTeXクラスファイルの内部動作に関する私の知識はとても制限があり、依存関係が多すぎるため、どこから始めればよいかわかりません。 - パッケージをオフにすると
cite
、引用は [1] ([?] ではなく) として正しく表示されますが、クリックできません。 - などの一部の標準パッケージは、
amsthm
ファイルに組み込まれていますasl.cls
(ただし、その方法は完全には理解していません)。
hyperref
そこで、私の質問は次のとおりです。 、cleveref
およびcite
パッケージを (おそらく の修正バージョン)と一緒に使用する方法はありますかasl.cls
?
答え1
私はファイルを調べてasl.cls
、asl.bst
ドキュメント クラスのユーザー ガイド ( asldoc.ps
) の意味を理解しようとしました。
ファイルのコピーを作成し
asl.cls
、そのコピーを と呼んでいますals-mod.cls
。ファイルを
als-mod.cls
テキスト エディターで開き、の (再) 定義が始まる 3332 行目に移動します\bibliographystyle
。このマクロの (再) 定義全体、つまり 3332 行目から 3349 行目をコメント アウトします。メインの tex ファイルで、
asl-mod
を の必須引数として指定し\documentclass
、オプションbibother
とを指定しますotherbib
(はい、この両方です)。メインの tex ファイルで、 の引数を から に変更します。
\bibliographystyle
ファイル内のコーディングは、単に許容範囲を超えています。修正しようとしても意味がありません。ドキュメント クラスのユーザー ガイドでは、間接的ではありますが、 スタイルを使用して参考文献をコンパイルしても問題ないことが示されています。ぜひ実行してください。(ユーザー ガイドには、「 以外のスタイルを使用する理由はありません」と記載されています。これは参考文献スタイルの使用を推奨しているように聞こえますが、 を使用しなければならないという指示はありません。)asl
plain
asl.bst
asl
plain
asl
asl
asl
これらの変更により、\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}