0

How to place \hspace{} before \section{} and \subsection{}? I am using an \documentclass[12pt, a4paper]{article}. I want make custom command for \section{} and \subsection{} with different \hspace value. How to do it? Help!

1 Answers1

4

It is very hard to understand the question, which just has a fragment of code using an unshown package, and an undefined command, and nothing else. however I think you want this which just adds \hspace*{} to a copy of \section from article.cls

enter image description here

\documentclass{article}

\makeatletter \newcommand\sectionx[1]{@startsection {section}{1}{\z@}% {-3.5ex @plus -1ex @minus -.2ex}% {2.3ex @plus.2ex}% {\hspace*{#1}\normalfont\Large\bfseries}} \makeatother \begin{document}

\tableofcontents

\section{A section} aaa \sectionx{1cm}{Another section} aaa \sectionx{.5cm}{Yet another section} aaa \section{A final section} aaa

\end{document}

David Carlisle
  • 757,742