I've been messing with my margins, section dimensions, geometry package dimensions, and titlesec settings to get this layout (and have, so far, failed): (left margin set at 0.75in)
<-0.75in->HEADER LEFT HEADER RIGHT
<-0.75in->_______________________________________________
<-0.75in->1. Section heading
<-x->|
Some text blah blah blah..................
which is left-aligned with the section
heading.
I've tried utilizing \titleformat
to move the section number to the left, but this leaves the header left margin aligned with the main text. I'm also trying to do this within a custom class that I have built. For this reason, I would prefer to universally change the margin for the text within sections to be aligned with section title text, and allow for page margin changes without having to adjust a multitude of other values.
I hope this makes sense. Thanks.
EDIT: MWE
\documentclass[10pt, letterpaper, twoside]{article}
\usepackage[top=0.5in, bottom=0.5in, left=1.25in, right=0.75in]{geometry}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{indentfirst}
\usepackage{lipsum}
\fancypagestyle{fancyHW}
{
\fancyhf{}
\renewcommand{\headrulewidth}{1pt}
\setlength{\headheight}{0.75in}
\setlength{\headsep}{12pt}
\setlength{\footskip}{30pt}
\setlength{\textheight}{670pt}
\fancyhead[HL]{10/22/2014}
\fancyhead[HC]{\footnotesize\textbf{My Title}}
\fancyhead[HR]{Mr. Stumped}
\fancyhead[RO]{\footnotesize \bf \thepage}
}
\fancypagestyle{fancyHWrest}
{
\fancyhf{}
\renewcommand{\headrulewidth}{1pt}
\setlength{\headheight}{0.75in}
\setlength{\headsep}{12pt}
\setlength{\textheight}{670pt}
\fancyhead[RE]{\footnotesize \it \nouppercase{\rightmark}}
\fancyhead[LO]{\footnotesize \it \nouppercase{\rightmark}}
\fancyhead[RO, LE]{\footnotesize \bf \thepage}
}
\pagestyle{fancyHWrest}
\renewcommand{\sectionmark}[1]{ \markright{#1}{} }
\thispagestyle{fancyHW}
\setlength{\parindent}{0pt}
\titleformat{\section}[block]{\bfseries\large\hspace{-0.5in}}{\thesection.}{\leftmargin}{}
\begin{document}
\section{The First Section}
As you can see, the header is aligned with the text. I am trying to get the header aligned with the section number while keeping the text aligned with the section title.
\lipsum
\section{The Next Section}
It also gets really messed up for two-sided documents, if the left and right margin are set to different values. Moving only section text would alleviate this problem.
\end{document}
CLARIFICATION: I apologize if this is confusing. Let me try to clarify what I have, compared to what I want to accomplish.
-What I have:
I am able to align the section body text with the section label text by shifting the section label number -0.5in into the left margin and aligning the section label text with \leftmargin
. However, this is a two-sided document. So, if I decide to make the "inner" margin smaller than the "outer" margin (as is with the MWE), there is a problem: it is fine on odd pages where the section number is 0.75in from the left side of the page. However, because of the section number's offset into the left margin, the section number becomes 0.25in from the left side of the page on even pages.
-What I'm trying to accomplish:
Align the section number with \leftmargin
and align both section label text AND section body text a specified distance from \leftmargin
. This would allow me to change the margins within geometry
at will, without the current spacing problem between the left side of the page and section numbers on even pages.
\documentclass...\begin{document}...\end{document}
, it should compile and contain close to the minimal amount of code needed to explain/demonstrate what you are asking. This saves a lot of time for everyoneH
specification forfancyhead
?