I want to set a counter (auto) like:


Question 1. Question 2. Example 3. Example 4. Question 5. Question 6.

Can you help me. Thankyou so much.

  • 1
    Welcome to TeX.SE! – Mensch Apr 3 at 8:10

Welcome Đặc Vụ :))) Although using question and example from amsthm is the best way, one can always define a new counter and use it.

\textbf{\stepcounter{yourcounter}Question \arabic{yourcounter}:} \textit{#1}\par}
\textbf{\stepcounter{yourcounter}Example \arabic{yourcounter}:} \textit{#1}\par}
\yourquestion{How many continents are there?}
\yourexample{This example is for no purposes.}
\yourexample{And this is another example.}
\yourquestion{This is another question.}
\yourexample{How about the numbering of this example?}
\yourquestion{Lorem ipsum dolor sit amet, consectetur adipiscing elit. In eget viverra eros. Donec commodo dapibus dictum. Etiam non ex placerat, fermentum ex sed, suscipit sem. Praesent facilisis vel quam non fringilla. Morbi sagittis tortor sed varius luctus. Curabitur ullamcorper ante scelerisque quam commodo, quis imperdiet sapien maximus. Phasellus bibendum, ligula eu tempor vulputate, tortor erat bibendum sem, eget lacinia mauris dui ac elit.}

enter image description here


Like this?



\section{Questions and Examples}


$\int \dfrac{1}{1+x} \mathrm{d}x=?$



$2\times 5=10$


enter image description here

  • That's right what I need. Thank you so much. – Đặc Vụ X Nguyễn Apr 3 at 8:45
  • @ĐặcVụXNguyễn, your welcome. But, I think you will use JoulV's answer. – ferahfeza Apr 3 at 8:55
  • @ĐặcVụXNguyễn, did you copy my answer? I will delete it soon. – ferahfeza Apr 3 at 9:17
  • @ferahfeza Please don't delete your answer! – user156344 Apr 3 at 9:20

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.