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.

I created a \newcommand to allow me to quickly create one-item lists.

\newcommand{\itemm}[1]{\begin{itemize}\item #1 \end{itemize}}

When I used \item, I don't have to put braces around the text. Is there a way I can allow my new macro \itemm to work without braces?

e.g.

\begin{itemize}
\item Pennsylvania    % no braces works fine
\end{itemize}


\itemm {Philadelphia}  % \itemm currently requires braces
                       % or only the first character is itemized
\itemm Pittsburg       % I would like \itemm to not require braces
                       % and to itemize the entire string
share|improve this question
    
This really won't end well, but you can define a custom end-character if you bop down to the lower-level TeX primitive \def: \def\itemm#1@{This command must be used with an ending @}. The use \itemm some text @ would, I think, put {some text } into #1. –  Sean Allred Feb 24 at 3:25
8  
The problem with your desire is that there is no way to tell where the \item is supposed to end. –  Steven B. Segletes Feb 24 at 4:17
    
You could define something like a subparagraph (or create a new sectioning level) that would emulate the behaviour of itemize. –  Bernard Feb 24 at 9:44
1  
It seems that you are trying to replace a feature of good editor with bad LaTeX. Your editor should be able to learn new commands and insert all kind of braces properly automagically. Which editor are you using? –  Keks Dose Feb 24 at 9:59
2  
"entire string" is not defined, you appear to want to take up to the next paragraph (and only allow one paragraph???) that's possible but would be against the latex syntax, latex goes to some lengths to give commands a consistent syntax. The end of each item is marked by the next \item or the \end{itemize} –  David Carlisle Feb 24 at 9:59

1 Answer 1

As noted in the comments, this might be a bad idea, since it is inconsistent with LaTeX syntax. The reason braces are not used within itemize is that it is already in an environment. The text is not the argument of \item as much as \item indicates where the text should be divided. In your usage however, the text should really be seen as an argument of \itemm, so braces are appropriate.

That said, it can be achieved with the plain tex \def.

\def\itemm #1 {\begin{itemize}\item #1\end{itemize}}

The defined command takes everything up to the next whitespace (space, tab or linebreak, but not a fixed space ~) as argument.

share|improve this answer

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.