Hot to get a bold odd-numbered list in LaTeX?

烈酒焚心 提交于 2021-02-10 15:28:30

问题


\begin{enumerate}[label=\textbf{\arabic*.}]
   \item Numbered 1
   \addtocounter{enumi}{1}
   \item Numbered 3
   \addtocounter{enumi}{1}
   \item Numbered 5
   \addtocounter{enumi}{1}
   \item Numbered 7
   \addtocounter{enumi}{1}
   \item and so on...
\end{enumerate}

Is there a better way to get enumerate to give you a list of just the odd numbers without having to add an \addtocounter between every item?


回答1:


Reworking this reference from TeX.SX quickly enough, my first suggestion would be the following, using the environment itemize instead of enumerate:

\documentclass{article}
\begin{document}
\begin{itemize}
  \item [\textbf{1}] Numbered 1
  \item [\textbf{3}] Numbered 3
  \item [\textbf{5}] Numbered 5
  \item [\textbf{7}] Numbered 7
  \item [\textbf{9}] and so on...
\end{itemize}
\end{document}

But then the question may become: is there a better way to get whay I want ... without having to add a \textbf to the optional argument of every item? Of course yes and, to keep it easy, again my first thought was to try the environment description here. If you compile the code below, you'll see the two ways "only" differ in indentation. Now the indentation of an environment may be set locally or globally or redefined, but definitely out of this scope.

\documentclass{article}
\begin{document}
\begin{itemize}
  \item [\textbf{1}] Numbered 1
  \item [\textbf{3}] Numbered 3
  \item [\textbf{5}] Numbered 5
  \item [\textbf{7}] Numbered 7
  \item [\textbf{9}] and so on...
\end{itemize}

Some text.

\begin{description}
    \item [1] Numbered 1
    \item [3] Numbered 3
    \item [5] Numbered 5
    \item [7] Numbered 7
    \item [9] and so on...
\end{description}
\end{document}


来源:https://stackoverflow.com/questions/47142774/hot-to-get-a-bold-odd-numbered-list-in-latex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!