Re: [問題] IEEEtran.cls

作者: andrew43 (討厭有好心推文後刪文者)   2022-08-23 17:56:53
以下我列出二種情況,其一是全局所有清單皆作用,其二是只作用在特定的清單。
如果你要全局皆以這樣的方式呈現,
不需要用到enumerate的功能,只要把我提出的方法做合適調整即可。
若還有類似需求,其實把我的renewcommand看懂就知道怎麼做,
建議還是試著學習一下,並沒有很難懂。
以下是全局皆作用的例子
%%%%
\documentclass[]{IEEEtran}
\begin{document}
\renewcommand{\labelenumi}{\Alph{enumi})} % 重新定義數字清單第一層樣式
\renewcommand{\labelenumii}{\alph{enumii})} % 重新定義數字清單第二層樣式
\renewcommand{\theenumi}{\Alph{enumi}} % 重新定義呼叫數字清單第一層樣式
\renewcommand{\theenumii}{)\alph{enumii}} % 重新定義呼叫數字清單第二層樣式
\begin{enumerate}
\item\label{A1} asdf
\item\label{A2} asdf
\begin{enumerate}
\item\label{A3} asdf
\item\label{A4} asdf
\end{enumerate}
\item\label{A5} asdf
\end{enumerate}
\vspace{5ex}\ref{A1}\quad \ref{A2}\quad \ref{A3}\quad \ref{A4}\quad \ref{A5}
% 得到 A B B)a B)b C
\end{document}
%%%%
如果只有部份的數字清單需要有特別指定的呈現方式,
我不會去使用特別的package,而是自定義一個新的環境。
這能夠讓預設環境和自定義環境同時出現。
例如:
%%%%
\documentclass[]{IEEEtran}
% 自定義環境customenumerate
\newenvironment{customenumerate}{
\renewcommand{\labelenumi}{\Alph{enumi})} % 重新定義數字清單第一層樣式
\renewcommand{\labelenumii}{\alph{enumii})} % 重新定義數字清單第二層樣式
\renewcommand{\theenumi}{\Alph{enumi}} % 重新定義呼叫數字清單第一層樣式
\renewcommand{\theenumii}{)\alph{enumii}} % 重新定義呼叫數字清單第二層樣式
\begin{enumerate}
}{
\end{enumerate}
}
\begin{document}
\begin{enumerate} % 使用預設的enumerate
\item\label{O1} asdf
\item\label{O2} asdf
\begin{enumerate}
\item\label{O3} asdf
\item\label{O4} asdf
\end{enumerate}
\item\label{O5} asdf
\end{enumerate}
\begin{customenumerate} % 使用自訂義的customenumerate
\item\label{A1} asdf
\item\label{A2} asdf
\begin{enumerate}
\item\label{A3} asdf
\item\label{A4} asdf
\end{enumerate}
\item\label{A5} asdf
\end{customenumerate}
\begin{enumerate} % 再次使用預設的enumerate
\item\label{P1} asdf
\item\label{P2} asdf
\begin{enumerate}
\item\label{P3} asdf
\item\label{P4} asdf
\end{enumerate}
\item\label{P5} asdf
\end{enumerate}
\vspace{5ex}\ref{O1}\quad \ref{O2}\quad \ref{O3}\quad \ref{O4}\quad \ref{O5}
% 得到 1 2 2a 2b 3
\vspace{5ex}\ref{A1}\quad \ref{A2}\quad \ref{A3}\quad \ref{A4}\quad \ref{A5}
% 得到 A B B)a B)b C
\vspace{5ex}\ref{P1}\quad \ref{P2}\quad \ref{P3}\quad \ref{P4}\quad \ref{P5}
% 仍然能得到預設的 1 2 2a 2b 3
\end{document}
%%%%
※ 引述《cholauda (cholauda)》之銘言:
: 非常感謝大大解惑
: 有一個小小的功能希望能加上去,現在無法自行定義編號格式,請問大大該如何修正?
: 完整原碼如下,非常謝謝您。
: \documentclass[]{IEEEtran}
: \usepackage{enumerate}
: \begin{document}
: \renewcommand{\labelenumi}{\arabic{enumi})} % 重新定義數字清單第一層樣式
: \renewcommand{\labelenumii}{\Alph{enumii})} % 重新定義數字清單第二層樣式
: \renewcommand{\theenumi}{\arabic{enumi}} % 重新定義呼叫數字清單第一層樣式
: \renewcommand{\theenumii}{)\Alph{enumii}} % 重新定義呼叫數字清單第二層樣式
: \begin{enumerate}[A)] % 僅修改了這一行,希望自行定義編號格式,但是結果就失敗了
: \item\label{A1} asdf
: \item\label{A2} asdf
: \begin{enumerate}[a)]
: \item\label{A3} asdf
: \item\label{A4} asdf
: \end{enumerate}
: \item\label{A5} asdf
: \end{enumerate}
: \vspace{5ex}
: \ref{A1}\quad \ref{A2}\quad \ref{A3}\quad \ref{A4}\quad \ref{A5}
: % 預期要得到 A B B)a B)b C
: % 卻得到 A B Ba Bb C
: \end{document}
作者: cholauda (cholauda)   2022-08-24 12:07:00
非常感謝大大解惑,小弟如法炮製學起來並應用在不同設定

Links booklink

Contact Us: admin [ a t ] ucptt.com