1

I have a main text that calls other texts in, and for some reason, despite the main.tex specifically saying no indentation, the tex file indents the first line of every section after the first section.

\documentclass[10pt]{article} % 11pt font

\usepackage[% colorlinks = true, citecolor = blue, linkcolor = blue, urlcolor = blue, unicode, ]{hyperref} % 1in margins \usepackage[margin=1in]{geometry} % single line spacing \usepackage{setspace}

\singlespacing

\usepackage[tiny,compact]{titlesec} \titleformat{\section}[runin]{\bfseries}{\thesection}{1em}{} \titleformat{\subsection}[runin]{\bfseries}{\thesubsection}{1em}{}

\usepackage{amsmath} \usepackage[final,nopatch=footnote]{microtype} \usepackage{xcolor}

\usepackage{amssymb} \usepackage{cleveref} \usepackage{rotating} \usepackage{tablefootnote}

\newcommand{\note}[1]{\textsf{\textcolor{red}{#1}}}

\newcommand{\comment}[1]{}

\usepackage{etoolbox} \usepackage{tikz} \usepackage{caption}

% \usepackage{hyperref}[hyperfootnotes=false] \usepackage[% autocite = plain, backend = biber, doi = true, url = true, giveninits = true, hyperref = true, maxbibnames = 99, maxcitenames = 99, sortcites = true, style = numeric, ]{biblatex} \usepackage{blindtext} % \input{bibliography-mimosis} % \addbibresource{references.bib}

% ------------------------- % BEGINNING OF THE DOCUMENT % ------------------------- \begin{document}

\begin{center} {\bf Some title} \ \bf{for the} \ \bf{document} \end{center}

\begin{center} My Name \end{center}

\begin{center} \par\noindent\rule{\textwidth}{0.2pt} \section*{\textsc{\textmd{Summary}}} \par\noindent\rule{\textwidth}{0.2pt} \end{center}

\blindtext

\begin{center} \par\noindent\rule{\textwidth}{0.2pt} \section*{\textsc{\textmd{Background}}} \par\noindent\rule{\textwidth}{0.2pt} \end{center}

\blindtext \end{document}

Yet for some reason, for the background and beyond tex files, I still have to specify \noindent

Thanks in advance for helping out

Alex

Edit: The Latex script to give a test document. Hopefully, the edit will also keep with the original question and not breach the guidelines.

2nd Edit: How do I add the titles in the format they are currently in without them counting as the first line in the first paragraph? So that the opening line for the corresponding line to the section is not indented. I would like not to use \setlength{\parindent}{0pt} or \noindent in the preamble and body of text respectively.

Thanks

Alex

  • 2
    Can you make a test document which we can compile without having access to your local files? – samcarter_is_at_topanswers.xyz Mar 08 '24 at 11:52
  • 3
    Unrelated, but please read https://tex.stackexchange.com/questions/516/does-it-matter-if-i-use-textit-or-it-bfseries-or-bf-etc – samcarter_is_at_topanswers.xyz Mar 08 '24 at 11:53
  • You are already using titlesec. So why don't you add the centering and the horizontal lines to the titlesec configuration of \section (or \section*)? As an alternative to titlesec you could also use sectsty and see the \sectionrule example in section 8.2 of the manual. – cabohah Mar 08 '24 at 12:49
  • Off-topic: You should not load packages (e.g. hyperref) more than once at least not with different options. And if you want to set options for a package, the optional argument has to be before the mandatory with the package name. (The meaning of the optional argument after the package name is for version selection if supported). – cabohah Mar 08 '24 at 12:51
  • you have declared section to be a runin rather than display heading so indentation of the following paragraph isn't something that needs to be considered. it is very hard to understand your question as you provde no example showing the problem. – David Carlisle Mar 08 '24 at 14:03
  • If nothing else works: At the start of the text that you do not want indented, write \strut\hspace{-\parindent}. Might need an asterisk on the \hspace. This is brute force, so be careful. – rallg Mar 08 '24 at 16:43
  • 1
    You don't have any paragraphs of text after a section heading You should remove all the center. rule \par and \noindent and font commands in a section argument. which should never appear in the document body, they are part of the styling of section heads that you specify elsewhere. If you have the intended markup \section*{Background} Some more text that will also be indented, like I don't want Then the text does follow the section heading. – David Carlisle Mar 08 '24 at 17:36
  • 1
    \bf has not been defined by default in latex for 30 years, it is defined in article class for comaptibility with documents from the1980s but it does not take an argument it was {\bf document} not \bf{document} the later would make any following text bold as well. – David Carlisle Mar 08 '24 at 17:39
  • 1
    Now you have added some text it's clear that your section declarations are wrong, you can only have a ruled heading like that for a display heading you have specified runin which means the heading is essentially the first few words of the paragraph and so can not have vertically spaced rules above and below. – David Carlisle Mar 08 '24 at 17:41

1 Answers1

2

By default, LaTeX indents all paragraphs with the length \parindent, except the first ones of each section. I don't see any setting in your code saying that you don't want indentation. Simply set \parindent to zero:

\setlength{\parindent}{0pt}
jlab
  • 1,834
  • 1
  • 13