0

I'm writing my dissertation, but it getting missed with the format because the number starts from 0 for each section, and I want to start from 1.

Also, the paragraphs start from the center. Here is my code.

\documentclass[fleqn]{unmeethesis}
  \usepackage[document]{ragged2e}
  \usepackage{comment}
  \usepackage{lipsum}
  \usepackage{mathrsfs}
  \usepackage{xspace}
  \usepackage{verbatim} 
  \usepackage{graphicx}
  %%\usepackage{epstopdf}
  \usepackage[table]{xcolor}
  \usepackage[cmex10]{amsmath}

\usepackage{pifont,tikz,paralist,multirow,amssymb,amsthm} \usepackage[ruled,linesnumbered]{algorithm2e} \theoremstyle{definition} \newtheorem{defn}{Definition} \newtheorem{theorem}{Theorem} \newtheorem{lem}{Lemma}

\usepackage{etoolbox} \patchcmd{\thebibliography}{\section*{\refname}}{}{}{} \usepackage{titlesec} \newcommand{\removelatexerror}{\let@latex@error@gobble} \usepackage{cite,graphicx,,booktabs,bm, caption,subcaption,soul} \begin{document}

\stepcounter{chapter} % just for this example \section{Hello World}

\end{document}

Mico
  • 506,678
Jared
  • 13
  • 3
  • 1
    Welcome to TeX.SE. It would help if you removed code that isn't related to your question, and also removed \input for files we don't have. (Also, don't \removelatexerror.) But with all of that, what is your purpose of having \setcounter{section}{-1}? – Teepeemm Aug 01 '22 at 22:26
  • I tried $\setcounter{section}{-1}$ but it doesn't work. – Jared Aug 01 '22 at 22:29
  • 4
    You haven't removed the unnecessary code. But my question is: Why do you have \setcounter{section}{-1} in the first place? The only thing I can see that doing is making your section numbers start from 0, which is exactly what you're complaining about. – Teepeemm Aug 02 '22 at 02:40
  • I did and I updated the code as well. – Jared Aug 02 '22 at 06:43
  • 1
    Welcome to TeX.SE. It seems your are using a specific class named unmeethesis, which I think is from this link found in this question. At line 973 is the start of some commands like \newcommand\section, I'd guess whoever created your class, reformatted sections, subsections and so on to appear exactly as you don't want. To achieve the design you want, you will have to edit there or add something that overrides it. – FHZ Aug 02 '22 at 09:04
  • 3
    Your updated code does not show the problems you describe. It's also impolite (at best) to edit your post so that an existing answer is incorrect. – Teepeemm Aug 02 '22 at 13:40
  • Hi FHZ, sorry, what do I need to modify? – Jared Aug 02 '22 at 17:45

1 Answers1

4

(Remark: The answer shown below is based on the initial version of the OP's query. After I posted this answer, the OP chose to completely modify the code that's shown. The answer I posted here therefore no longer has any bearing on the OP's query. Sorry.)

the [section] number starts from 0 for each section, and I want to start from 1.

My hunch is that this issue is caused by the instruction

\setcounter{section}{-1}

Also, the paragraphs start from the center.

Your second formatting issue almost certainly owes to the following instruction:

\titleformat*{\section}{\centering\normalsize\bfseries}

Do check if deleting -- or, at the very last, commenting out -- these two instructions fixes your document's formatting woes.


A general comment: I couldn't help but notice that there is a lot of duplication and other forms of redundancy in your preamble. E.g., quite a few packages are loaded at least twice, and some even more frequently -- I'm looking at lipsum and graphicx, for instance but there may be other packages that are loaded at least thrice.

I think you would do very well to eliminate these redundancies, in no small part because doing so would likely force you to become acquainted with what the code is supposed to do. Understanding the preamble code a bit better would provide an excellent opportunity to determine which parts of the code are, in fact, irrelevant, unhelpful or, worst, inimical to your document's formatting needs. A form of spring (or late-summer, maybe?) house cleaning, to put it politely.

Mico
  • 506,678
  • thank you for your time. I think this fixes the document a little bit. But the section parts start from the center, not from left to right :( Also, the text in my document goes more to the center I don't know why. – Jared Aug 02 '22 at 06:32
  • @Jared - Did you implement both suggestions I provided? – Mico Aug 02 '22 at 06:34
  • Yes, but still I have a problem as I describe above. – Jared Aug 02 '22 at 06:35
  • I updated the code above to check what I have now. – Jared Aug 02 '22 at 06:44
  • @Jared - You've changed your code so thoroughly that my answer no longer has any bearing on what's visible to readers. I've taken the liberty of editing your code so as to make it compilable. Your code no longer generates either of the two problems you mentioned initially, viz., incorrect initial section number and undesired centering of text of section-level headers. – Mico Aug 02 '22 at 09:31
  • Thank you for editing my code. I added it, but it's generating some errors, and the chapter I have like this \chapter{Introduction} \label{chap:first}. How to add the counter? – Jared Aug 02 '22 at 17:42
  • @Jared - "it's generating some errors" -- which errors would these be? Sadly (but maybe not surprisingly), my psychic divination skills are utter rubbish. FWIW, I get no errors when I compile the code (currently) shown in your query. – Mico Aug 02 '22 at 18:28
  • maybe because I used this \documentclass[fleqn]{unmeethesis}. This is the error "Misplaced alignment tab character &." – Jared Aug 02 '22 at 18:49
  • @Jared - The code shown (at this moment) in your query does not contain any & characters. As I wrote earlier, my psychic divination skills are worthless; I have no idea whatsoever as to what you may be doing and how you're trying to employ the & character. Hence, I'm sadly in no position at all to offer advice on how to fix whatever it is that is causing the error message you've encountered. – Mico Aug 02 '22 at 19:08