5

how to add the blacksquare before the caption in LaTeX?

just like the itemize, but at the caption

1. Introduction

lockstep
  • 250,273
linli
  • 53
  • 2

3 Answers3

7

You could use the titlesec package for customizing heading format and spacing, especially if there would be further requirements. Load the package, and use \titleformat for the format and \titlespacing for the spacing, described in the titlesec documentation.

Example:

\documentclass{article}
\usepackage{amssymb}
\usepackage{titlesec}
\titleformat{\section}
  {\normalfont\Large\bfseries}{\textbullet\thesection}{1em}{}
\begin{document}
\section{Introduction}
Text of introduction
\end{document}

enter image description here

Here you get a bullet as in itemize. For a black square, perhaps use \blacksquare of the amssymb package, as Axioplase wrote.

Stefan Kottwitz
  • 231,401
3

Something like this?

\documentclass{article}
\usepackage{amssymb}

\makeatletter
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{0mm}%                       % the indent
{-\baselineskip}%            % the before skip
{0.5\baselineskip}%          % the after skip
{$\blacksquare$~\bfseries\Large}} % the style
\makeatother

\begin{document}
\section[foo]{MySection}
\end{document}

enter image description here

Axioplase
  • 409
1

If you mean the chapter heading, have a look at my answer to this question. That should be relatively easy to modify for your purposes, once you know that itemize uses a \textbullet by default.

For the section headings you can renew the \section command, which uses the \@startsection macro as follows:

\makeatletter
\renewcommand{\section}{\@startsection
{section}%                   % the name
{1}%                         % the level
{0mm}%                       % the indent
{-\baselineskip}%            % the before skip
{0.5\baselineskip}%          % the after skip
{\normalfont\Large\bfseries\textbullet}} % the style
\makeatother
Roelof Spijker
  • 17,663
  • 5
  • 55
  • 63