It might be a simple yet a silly question but it keeps bugging me for days. Base on my code:
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry} % changes the margin
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{indentfirst}
\usepackage{blindtext}
\renewcommand\thesection{\Alph{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\titleformat{\section}
{\normalfont\fontsize{11}{.5em}\bfseries}{\thesection}{.5em}
{}
\titleformat{\subsection}
{\normalfont\fontsize{11}{.5em}\selectfont}{\thesubsection}{.5em}
{}
\titlespacing % starred version: first paragraph is not indented
{\subsection} % <command>
{1em} % <left>
{.4em} % <before-sep>
{.3em} % <after-sep>
\begin{document}
\section{Introduction}
\subsection{Subsection One}
\begin{itemize} [leftmargin=1.3cm,topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
\item some item here and there
\item some item here and there
\end{itemize}
\subsection{Subsection Two}
\setlength\parindent{.85cm} \blindtext
\end{document}
And it resulted in this picture
My question is, how can I adjust the paragraph margin parallel with the subsection number? and not the section number?
답변1
Is this what you want? It all relies on the \llap
command, which inserts its argument to the left of the current point on the line without moving the latter.
\documentclass[a4paper, 11pt]{article}
\usepackage[margin=2cm]{geometry} % changes the margin
\usepackage{enumitem}
\usepackage{titlesec}
\usepackage{indentfirst}
\usepackage{blindtext}
\renewcommand\thesection{\Alph{section}.}
\renewcommand\thesubsection{\arabic{subsection}.}
\titleformat{\section}
{\normalfont\fontsize{11}{.5em}\bfseries}{\llap{\thesection\hskip0.67em}}{0em}
{}
\titleformat{\subsection}
{\normalfont\fontsize{11}{.5em}\selectfont}{\thesubsection}{.5em}
{}
\titlespacing % starred version: first paragraph is not indented
{\subsection} % <command>
{0em} % <left>
{.4em} % <before-sep>
{.3em} % <after-sep>
\begin{document}
\section{Introduction}
\subsection{Subsection One}
\begin{itemize} [leftmargin=1.3cm,topsep=0pt,itemsep=0pt,parsep=0pt,partopsep=0pt]
\item some item here and there
\item some item here and there
\end{itemize}
\subsection{Subsection Two}
\setlength\parindent{.85cm} \blindtext
\end{document}