Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}\\}
share|improve this question

4 Answers 4

up vote 7 down vote accepted

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.)

share|improve this answer
    
Thank you very much! –  user1996 Dec 28 '10 at 17:56
    
Ok, is it possible to put \llap{$\bullet$ short text}this-text this-text beside bullet and short-text? Not underneath, please. –  user1996 Dec 28 '10 at 20:46
    
Nvm, I added \vspace{-12pt}... It looks fine. –  user1996 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 8:08

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.

share|improve this answer
    
I marked your inline code with backticks. –  Hendrik Vogt Dec 29 '10 at 8:12
    
@Hendrik: thank you. In addition to being a TeX novice, I'm a StackExchange novice too! It looks much clearer. –  Colin Fraizer Dec 29 '10 at 8:47

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}
share|improve this answer

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}

share|improve this answer
    
You can mark up code sections by indenting with four spaces or using the '101010' button in the editing window. –  Joseph Wright Dec 28 '10 at 20:06
    
Thanks, I just figured this out. I tried the 101010 button, but it only made the first line of my pasted example code. So it seems like its easier just to insert the <pre><code> .. </pre></code> tags manually, unless I'm missing something? –  Alan Munn Dec 28 '10 at 20:07
    
don't you want proper nesting? <pre><code> ... </code></pre>? ;-) Also, I didn't know about lipsum. Thanks! –  Colin Fraizer Dec 28 '10 at 21:06
    
Just highlight the code before hitting the button. –  Hendrik Vogt Dec 28 '10 at 22:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.