3

How can I create 'hanging bullet' (bullet in margin) followed with text. I would like to put it in \newcommand but I'm not managing to do it. I tried this:

\newcommand{\question}[2]{\\[0.5cm]\hspace{-4.5cm}\bullet\textbf{#1}\\[0.2cm]\hspace{5mm}\text{#2}\\}
lockstep
  • 250,273

4 Answers4

7

I'm not exactly sure what you're trying to achieve. I think you may want to use \llap:

\leavevmode\llap{$\bullet$ short text }Normal text here

(The \leavevmode is needed to start the paragraph.)

Hendrik Vogt
  • 37,935
  • Ok, is it possible to put \llap{$\bullet$ short text}this-text this-text beside bullet and short-text? Not underneath, please. –  Dec 28 '10 at 20:46
  • Nvm, I added \vspace{-12pt}... It looks fine. –  Dec 28 '10 at 20:49
  • @an_ant: I'm really sorry, I acted against my own principles and didn't test my answer before posting. Nevertheless, it would be good if add a minimal working example to your question; it's really hard to see what exactly you aim at. – Hendrik Vogt Dec 29 '10 at 08:08
4

Since it looks like you want this to be an environment, why not use the enumitem package:


\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}
\newlist{question}{itemize}{1}
\setlist[question]{label=\textbullet,labelindent=-.5in,leftmargin=0pt,labelsep=.25in}
\begin{document}
\lipsum[1]
\begin{question}
\item \lipsum[2]
\item another item
\end{question}
\end{document}
Alan Munn
  • 218,180
1

Your attempt to shift the bullet into the margin with a negative \hspace didn't work because it inserts glue. When TeX breaks your paragraph into lines, it discards the glue at the beginning of the line, so you end up with a line \hbox that starts with the bullet character.

I replaced your \hspace{-4.5cm} with \llap{\textbullet}. That generates a zero-width \hbox inside your paragraph. That generated \hbox contains \hss followed by \textbullet. When TeX breaks the paragraph into lines, the generated \hbox is not discarded, but is placed at the beginning of the line.

[The \hss has natural width of 0, but shrinks by the size of the \textbullet (so the \hbox can stay zero-width). It "backspaces" by the size of the bullet into the left margin. The bullet is set, bringing us back to "beginning" of the line (the reference point) and then the text "Question?" is set.]

\loggingall
\documentclass{article}

\newcommand{\question}[2]{\\[0.5cm]\hspace{-4.5cm}\textbullet\textbf{#1}\\[0.2cm]\hspace{5mm}\textrm{#2}\\}
\begin{document}
This is a test.
\question{Question?}{Answer.}

This is also a test.
\showlists
\vfil
\pagebreak[4]
\renewcommand{\question}[2]{\\[0.5cm]\llap{\textbullet}\textbf{#1}\\[0.2cm]\textrm{#2}\\}
This is a test.
\question{Question?}{Answer.}

This is also a test.
\showlists
\end{document}

Note 1: I changed \text to \textrm in your macro.

Note 2: This is my first attempt at an answer, so it's highly likely that I didn't solve the problem with good LaTeX style. I thought I might learn something by trying to give an answer. (I did!) I hope the rest of the community will be forgiving of whatever stupid errors I committed.

Hendrik Vogt
  • 37,935
0

This tricky solution is taken from the TexBook. It defines the command \marginalbullet that can be used anywhere inside a paragraph.

\documentclass{article}
\usepackage{lipsum}
\parindent=0pt
\parskip=10pt
\def\strutdepth{\dp\strutbox}
\def\specialbullet{\vtop to \strutdepth{
  \baselineskip\strutdepth
  \vss\llap{$\bullet$ }\null}}
\def\marginalbullet{\strut\vadjust{\kern-\strutdepth\specialbullet}}
\begin{document}
Text before \marginalbullet \lipsum[1]\par\lipsum[2]
\end{document}
rgallego
  • 2,112