2

I tried, \setcounter{enumi}{1.0}, but it didn't work and just gave me an error. How can I achieve that?

  • 3
    Where does the leading 1. come from? Is it part of a larger list? Or an outline? Are you going to want a 2. for some other reason? Could you give an example of why you want this? There are several valid reasons, but I think they would lead to slightly different answers. – Teepeemm Sep 9 '18 at 19:22
  • So I am using latex to do homework problems. This is from chapter 4 of the book so the assigned problems were 4.1, 4.2, 4.3, 4.4, 4.10, 4.11, and some others. Some of the problems have additional parts (i.e, 4.1 a, 4.1 b, etc.) so I figured \begin{enumerate} would be the way to go. – Mohammed Shahid Sep 9 '18 at 19:27
  • @MohammedShahid: Then you can use \begin{enumerate}[\thechapter.1] \item foo \item bar \end{enumerate} – current_user Sep 9 '18 at 20:09
  • 1
    @current_user no he can't as he is doing homework and not writing that book. It is unlikely that \thechapter would yield the correct result. – Skillmon Sep 9 '18 at 20:57
  • @Skillmon: Oh, sorry, my fault, I mean something like \newcommand{\NAME}{\thesection} and then the same usage which is shown in my answer … – current_user Sep 9 '18 at 20:59
5

With enumitem:

\documentclass[]{article}

\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label=1.\arabic*]
  \item foo
  \item bar
\end{enumerate}
\end{document}

enter image description here

  • When I do: \begin{enumerate}[label=1. \arabic*] The asterisks appears with the \arabic and appears red. Which leads to me getting a dozen errors. – Mohammed Shahid Sep 9 '18 at 18:56
  • 1
    @MohammedShahid then post an MWE which shows which document class you're using and produces the error you're facing with my code, the MWE in my answer does work. And please answer the questions asked in Teepeemm's comment below your question (that might enhance our ability to answer your question a lot). – Skillmon Sep 9 '18 at 19:27
  • the only thing I have after begin{document} is the code you put. And it is giving me a lot of errors. Could one of the commands I have in the preamble before then mess with this? I did use the enumitem package.The error messages are as follows: ! Missing number, treated as zero.<to be read again>\c@ \begin{enumerate}[label=1.\arabic]. The second one is: ! Missing number, treated as zero.<to be read again>\c@ \item f The third is: ! Undefined control sequence.\enit@endenumerate ->\enit@after\endlist \ifx \enit@series \relax \else \if... \end{enumerate} – Mohammed Shahid Sep 10 '18 at 0:42
  • I figured it out. I removed \usepackage{enumerate} and then it worked. Do these packages not work with each other? – Mohammed Shahid Sep 10 '18 at 0:44
  • 1
    @MohammedShahid sure, you can use \begin{enumerate}[label=1.\arabic*,start=2] – Skillmon Sep 10 '18 at 13:35
3
\documentclass{article}
\usepackage{enumerate}
\newcommand{\one}{1}
\begin{document}
    \begin{enumerate}[\one.1]
            \item Hallo
            \item Hallo
    \end{enumerate}
\end{document}

Here is the output:

Screenshot

  • 1
    I would have to make this command: \newcommand{\one}{1} for every number, right? – Mohammed Shahid Sep 9 '18 at 18:50
  • @MohammedShahid: Yeah, you're right … But Skillmon's answer is better than mine, so use his. – current_user Sep 9 '18 at 18:51
  • 1
    Why not just \begin{enumerate}[{1}.1]? – L. F. Apr 29 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.