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}
2
  • 4
    \begin{itemize}\item <long sentence>\end{itemize}
    – egreg
    Oct 20, 2015 at 22:33
  • 1
    What's the problem with itemize?
    – egreg
    Oct 21, 2015 at 6:22

3 Answers 3

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}
2
  • 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, 2015 at 22:32
  • 1
    @englealuze: Answer updated.
    – Guho
    Oct 20, 2015 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

0
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

4
  • 1
    Nice. Can you please adapt your solution to \textbullet ?
    – MS-SPO
    Jul 18, 2022 at 17:58
  • @MS-SPO I guess adding \textbullet just before lipsum[1] on the third-last-line should do the trick. Let me know if I'm missing something. Jul 20, 2022 at 11:31
  • Please check AND modify your answer accordingly, so everything is in one place only.
    – MS-SPO
    Jul 20, 2022 at 11:33
  • 1
    @MS-SPO. Thanks for your suggestion. I have edited the answer accordingly. Jul 23, 2022 at 13:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .