0

I am curious of how to insert '§' in the section heading like the image below? Thanks!

The following is the setup I have:

\documentclass[a4paper, 12pt]{article} 
\usepackage{geometry} 
\geometry{ left=1.30in, right=1.30in, } 
\usepackage{csquotes} 
\usepackage{setspace} 
\usepackage{stmaryrd} 
\usepackage{lmodern, enumitem}
\usepackage{amssymb,amsmath} 
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage{fontspec} 
\setmainfont{Palatino}

enter image description here

JamesT
  • 3,169
  • 2
    Depends on what your setup is, so please provide a minimal example the resembles the setup you're using (documentclass and relevant packages) – daleif May 10 '23 at 13:23
  • The following is the setup I have:

    \documentclass[a4paper, 12pt]{article}

    \usepackage{geometry} \geometry{ left=1.30in, right=1.30in, }

    \usepackage{csquotes}

    \usepackage{setspace} \usepackage{stmaryrd} \usepackage{lmodern, enumitem} \usepackage{amssymb,amsmath}

    \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fontspec}

    \setmainfont{Palatino}

    – Andrew Leung May 10 '23 at 13:33
  • 1
    Welcome! What daleif meant is that you should write something like this in the body of your question, not in a comment. – Luis Turcio May 10 '23 at 13:41
  • Thank you so much for your reminder! – Andrew Leung May 10 '23 at 13:45
  • It would help if you could extend your code so we can compile it i.e. make a small example that ends with \end{document} so we can copy and paste it without having to build it ourselves :) – JamesT May 10 '23 at 14:01
  • Thank you so much!!!! – Andrew Leung May 10 '23 at 14:29

2 Answers2

1

This is an option with titlesec package:

\documentclass[a4paper, 12pt]{article}
\usepackage{geometry}
\geometry{ left=1.30in, right=1.30in }
\usepackage{csquotes}
\usepackage{setspace}
\usepackage{stmaryrd}
\usepackage{lmodern, enumitem}
\usepackage{amssymb,amsmath}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} this is not needed
\usepackage{fontspec}

%here is the code to format sections \usepackage{titlesec} \titleformat{\section}[hang]{\bfseries}{\S\thesection}{5mm}{}{}

\begin{document} \section{Hello world} \end{document}

enter image description here

More information about the formatting could be found in the documentation of the package

Luis Turcio
  • 2,757
1

This can be handled with the titlesec package. This only adds the paragraph symbol to the section:

\documentclass[a4paper, 12pt]{article}

\usepackage{titlesec}

\titleformat{\section} {\normalfont\Large\bfseries}{\S\thesection}{1em}{}

\begin{document} \section{start} \subsection{next} \end{document}

mrCarnivore
  • 1,505