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.

For reasons too complicated to go into here, I need the ability to create something that looks like a list item without using a list. Specifically, I want each item to begin with a mark (which is a triangleleft, but that doesn't matter), and the text, if it wraps multiple lines, to wrap and indent just as a list item should. [Edit: I actually need these ersatz items to be standalone - that is, not inside any kind of enclosing structure like a table that requires an opening token and a closing token].

From reading other notes, I gather I can do this using a minipage to indent the text. Is there an easier way without loading additional packages? Thanks.

[Edit: it appears that there is some doubt that this is really what I need. The requirements are laid out in more detail here. Bottom line: I have to put text inside another .tex file which, when processed, will create a tex file that I can process with a different set of macros to create my output. Thus the single tex file produces two PDFs eventually: the one generated by the file itself and the one generated by my generated tex file. The issue is that while I theoretically could use a list structure to hold the solutions that I'm writing, that requires a pretty complex set of boolean flags to put list ending code in the right place, and that is all pretty brittle. So I'd prefer a solution in which each solution stands alone.]

share|improve this question
    
Could you illustrate how your input might look? I assume there is something that defines the limits of the list and the items. –  Joseph Wright Feb 3 '13 at 14:32
    
The word list has a special meaning in LaTeX because it's the name of an environment. It is not clear why you cannot use a list environment. Are you sure this is what you want? –  Marc van Dongen Feb 3 '13 at 14:35
    
@josephwright No, there really isn't. I just want something that looks like a standalone list item but requires no enclosing structures. I can present the whole set of requirements if you want, but I think it will just confuse things. –  rogerl Feb 3 '13 at 14:35
    
Complicated or not, I wonder why you want to do this. Using \begin{itemize}...\end{itemize} adds structure to your document and makes it more readable. –  hpesoj626 Feb 3 '13 at 14:36
    
Perhaps I should restate the requirements in a way that avoids using list terminology. I need to be able, at arbitrary points in my text, create a paragraph that is wholly indented by some amount, say 3em, and that has a mark at the left margin on the first line. –  rogerl Feb 3 '13 at 14:37
show 1 more comment

5 Answers

up vote 3 down vote accepted

This may be what you want, with help from @ChristianR and from
change the itemize from bullet to square

 \documentclass{article}

\newenvironment{notalistitem}
{\begin{itemize}
\renewcommand{\labelitemi}{$\triangleright$} 
\item}
{\end{itemize}}

\begin{document}

Some text

\begin{notalistitem}
Here is text that should look like a list item although it doesn't
seem to be part of a list.
\end{notalistitem}

\begin{itemize}
\item This is part of a list.
\end{itemize}

\end{document}

enter image description here

Edit: You'll need something more robust if you want to use an itemize inside this new environment, or one of these inside an itemize.

share|improve this answer
    
I ended up going with this answer because I do need the ability to have multiple paragraphs. I would have liked to mark @egreg's as accepted as well, though. Thanks to all. –  rogerl Feb 4 '13 at 15:10
add comment

This won't work if \xitem is in a list environment, but only at the "outer level":

\documentclass{article}
\usepackage{lipsum} % for the mock text

\newcommand{\xitem}{%
  \par\hangindent3em\hangafter0
  \noindent\llap{$\triangleright$\enspace}%
  \ignorespaces}

\begin{document}
\lipsum[1]

\xitem\lipsum[2]

\lipsum[3]
\end{document}

enter image description here

In order to have the symbol flush with the left margin, you can do

\newcommand{\xitem}{%
  \par\hangindent3em\hangafter1
  \noindent\makebox[3em][l]{$\triangleright$}%
  \ignorespaces}

Hanging indentation starts after one line, but the beginning of the first line is occupied by a box with the same width as the indent.

share|improve this answer
    
this looks like exactly what I want. Is there a way to push the item left so that the triangle is flush with the left margin? –  rogerl Feb 3 '13 at 14:50
    
@rogerl I've added the change you requested –  egreg Feb 3 '13 at 17:05
add comment

What about something like

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\def\myitem{\hangindent=5em$\triangleright$}

\myitem \lipsum[1]

\myitem \lipsum[2]

\myitem \lipsum[3]

\lipsum[4]
\end{document}

The advantage of using \hangindent is it has a single paragraph scope so there is no effect after the item that needs to be "ended". The drawback is that it falls over if your "items" are more than 1 paragraph long.

share|improve this answer
add comment

You could use a table as follows (no packages required).

I've chosen p{5cm} for the second column to make the linebreak easier. This should give you an idea on how to tweak the table to get a result that you like.

Code

\documentclass{article}
\begin{document}

\begin{tabular}{lp{5cm}}
$\triangleright$ & some text \\
$\triangleright$ & a little bit more text, to provoke linebreak \\
$\triangleright$ & some text \\
\end{tabular}

\end{document}

Result

image

share|improve this answer
    
I wasn't clear enough in my original post. I need to do this in a way that does not use an opening and closing bracket, line \begin{itemize}\end{itemize} or similarly for tabular. –  rogerl Feb 3 '13 at 14:32
add comment

I won't go into whether there are better alternatives, but you can always use the TeX facilities built into the language for this kind of things, namely \parshape. Here's a simple macro that generates a paragraph with a hanging indent, using whatever symbol you want:

\def\ipar#1{\par\medskip
  \@tempdima=\textwidth \advance\@tempdima by -1.5em
  \parshape=2 0pt \textwidth 1.5em \@tempdima\relax
  \noindent\hbox to 1.5em {#1}}

You can use it like this (or define another macro to supply the triangle):

\ipar{$\bullet$\hfil} Here comes the paragraph text.

Explanation: \parshape is used with a number of pairs (<indentation>, <line length>). The last pair is used for any remaining lines. The syntax is

\parshape <number-of-pairs> (pair 1) (pair 2) ...

With judicious choices you can build circular paragraphs, etc. The rest of the macro calculates the line length from the desired indentation (which is hard-coded to 1.5em).

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.