4

I have a very long sentence after a \textbullet. Because it is very lone, it goes to the second line. But there is no indentation in the second line. How could I add indentation and align the second line of this sentence to its first line after the \textbullet?

I know this can be easily done with the itemize environment. But there are some reasons that I cannot use the itemize environment or any other list or table structures (Enumerate, Description, tabular, or tabularx). I have to use \textbullet in the plain text.

Here is what I got with \textbullet: Here is what I got with \textbullet:

Here is what I expected to have: Here is what I expected to have:

Here is a MWE:

\documentclass{article}

\begin{document}

\textbullet\ Long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text.

\end{document}
Torbjørn T.
  • 206,688

3 Answers3

4

Use the hanging indent:

\documentclass{article}

\begin{document}
\newlength\boxwid
\settowidth{\boxwid}{\indent\textbullet\ }
\hangindent=\boxwid
\textbullet\ Long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text.

\end{document}

enter image description here

As per the request below, you can redefine \textbullet to include this in each call. I should add that this is not advisable in general, as \textbullet may be used elsewhere. A better approach would be to wrap this in an environment (e.g., itemize, @egreg's suggestion in the comments) or a command (similar to @Bernard's answer). Regardless, you asked, so here it is:

\documentclass{article}

\newlength\boxwid%  
\let\oldtextbullet=\textbullet
\def\textbullet{%
    \settowidth{\boxwid}{\indent\oldtextbullet\ }%
    \hangindent=\boxwid%
    \oldtextbullet}
\begin{document}

\textbullet\ Long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text.

\end{document}
Guho
  • 6,115
  • 1
    Excellent! Thank you so much. But is there any way to summarize the code \newlength\boxwid \settowidth{\boxwid}{\indent\textbullet\ } \hangindent=\boxwid into a new command in preamble and use that to replace \textbullet? I have tried it in preamble, but it failed to compile. – englealuze Oct 20 '15 at 22:32
  • 1
    @englealuze: Answer updated. – Guho Oct 20 '15 at 23:19
2

Another solution modifying leftskip within a command:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\newcommand\hangbullet[1]{\leftskip1.5\parindent
\hspace*{-\parindent}\leavevmode\llap{{\textbullet\enspace}}#1\par\leftskip0pt}

\begin{document}

\hangbullet{Long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text, long text.}

\lipsum[11]

\end{document}

enter image description here

Bernard
  • 271,350
1

I'm 7 years late to the party, but this 2022 version is bit easier to consume. Use the package hang to achieve this, and set the hang length to any units LaTeX understands using \setlength{\hangingindent}{⟨length⟩} in the hang environment.

Example:

\documentclass{article}
\usepackage{lipsum}
\usepackage{hang}

\begin{document} \textbullet{ }\lipsum[1]

\setlength{\hangingindent}{5mm}
\begin{hangingpar}
    \textbullet{ }\lipsum[1]
\end{hangingpar}

\end{document}

Result: enter image description here

BhaveshDiwan
  • 123
  • 7