Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· openaiHugging Face Suzhen/CodeChat

I have this latex """ \newenvironment{legalsection}{ %…

  1. User

    I have this latex """ \newenvironment{legalsection}{

    % https://latex.org/forum/viewtopic.php?t=10456 \titleformat{\section}[block]{\bfseries}{\vspace{9pt}\thesection.0\hspace{1em}}{2em}{\fontsize{15pt}{\baselineskip}\selectfont\hangindent=2em} \titleformat{\subsection}[block]{\bfseries}{\vspace{9pt}\thesubsection\hspace{1em}}{2em}{\hangindent=2em} \titleformat{\subsubsection}[runin]{\bfseries}{\vspace{9pt}\thesubsubsection}{2em}{\hangindent=2em}

    \titlespacing*{\section}{0pt}{20pt}{0pt} \titlespacing*{\subsection}{0pt}{20pt}{3pt} \titlespacing{\subsubsection}{-4.5em}{20pt}{2em} \titlespacing{\paragraph}{-4.5em}{20pt}{0.25em} \setlength{\leftskip}{4.5em} % change bullet point indent to fix indentation of titles \setlist[itemize]{align=parleft,left=6em} % same thing but numbered bullet points \setlist[enumerate]{align=parleft,left=6em} }{} """

    but essentiall, I want to have a level3 header that is just a number, then the entire paragraph is tabbed in so 2.1.1paragraph where the following lines of the paragraph are all aligned with the first line

  2. Assistant

    You can create a custom level/\textit{subsubsubsection} format by using the \textit{titlesec} package and defining a new command. Here's an updated LaTeX code snippet that should achieve your desired formatting.

    \documentclass{article}
    \usepackage{titlesec}
    \usepackage{enumitem}
    
    \newenvironment{legalsection}{
        % Custom 'level 3 header' command
        \newcommand{\levelthree}[1]{%
            \vspace{1ex}\noindent\refstepcounter{subsubsection}\textbf{\thesubsubsection}\quad#1\par\noindent
        }
        % Section formats
        \titleformat{\section}[block]{\bfseries}{\vspace{9pt}\thesection.0\hspace{1em}}{2em}{\fontsize{15pt}{\baselineskip}\selectfont\hangindent=2em}
        \titleformat{\subsection}[block]{\bfseries}{\vspace{9pt}\thesubsection\hspace{1em}}{2em}{\hangindent=2em}
        \titleformat{\subsubsection}[runin]{\bfseries}{\vspace{9pt}\thesubsubsection}{2em}{\hangindent=2em}
    
        \titlespacing*{\section}{0pt}{20pt}{0pt}
        \titlespacing*{\subsection}{0pt}{20pt}{3pt}
        \titlespacing{\subsubsection}{-4.5em}{20pt}{2em}
        \titlespacing{\paragraph}{-4.5em}{20pt}{0.25em}
        \setlength{\leftskip}{4.5em}
        % Change bullet point indent
        \setlist[itemize]{align=parleft,left=6em}
        % Same thing but numbered bullet points
        \setlist[enumerate]{align=parleft,left=6em}
    }{}
    
    \begin{document}
    \begin{legalsection}
        \section{Section 1}
            \subsection{Subsection 1}
                \subsubsection{Subsubsection 1}
                    \levelthree{Level 3 header: Paragraph text example with a very long line that wraps around to the second line and is indented properly. The following lines of the paragraph are all aligned with the first line.}
                    \begin{enumerate}
                        \item Item 1
                        \item Item 2
                    \end{enumerate}
    \end{legalsection}
    \end{document}
    

    Now, you can use the \levelthree{} command inside the legalsection environment to create a level 3 header with the desired paragraph formatting.