5

This certainly sounds lazy, but my use case is designing a crude template for power point presenters to use in converting their content to a company's specific presentation standard, without their having to learn latex to actually use the highly specified template I design.

I am simplifying commands like \textit{} in the same way, which I may do with the \begin{itemize}\end{itemize} command, but not requiring an \item macro would be very valuable and practical in the scope of the company's standards (in the many cases where I would use this code) which stipulate (though not explicitly in TeX terms):

  1. That a sentence in content, or paragraph, will always be a separate bullet (\item), insuring that automating the macro would strictly be reducing the use cases to those allowed by the writing guidelines

  2. The same rule applies to all sub-points, so all sub itemizations need to follow this rule strictly as well

  3. The same rule applies to all enumerations too, except enumerations should only occur after an item

In theory, I would:

\documentclass{beamer}

%Define environments in the preamble%

%Design an environment

\newenvironment{content}{

\section{automated_heading}

 \begin{itemize}[option-to-skip-\item?}

%If it couldn't be an option, I'd include the script here%

\input{contentlocation.tex}

}{

\end{itemize}
}

Inside contentlocation.tex:

\begin{content} 

This is its own item, written out and on and up. Several sentences comprise this paragraph

But this paragraph  is its own item and always should be its own item, this limitation is hard-coded into the guidelines

\begin{itemize} %Or its shortcut macro%

This is a sub-point, requiring no \item tag either, only the itemize enclosure

\end{itemize}

\begin{enumerate} %Or its shortcut macro%

So this is the fourth item, but it is enumerated. All it needs is an enumerate enclosure. It is not solely an enumeration, it will always need an itemize enclosure to begin with, and follow a main point from this itemized list

\end{enumerate}

\end{content}
  • While this appeals to your laziness (and laziness can be a virtue), you'll soon regret not having well marked your document. – egreg Dec 5 '13 at 10:54
  • Yes I fear this would be a blind spot for troubleshooting, I'm guess I'll parse it outside instead. Still, it would be cool to see an implementation JFF! – PdfProfessionalPersonHere Dec 9 '13 at 4:18
2

The syntax to create a new environment is

\newenvironment{<name>}{<begin-code>}{<end-code>}

What you want can be achieved as

\newenvironment{myitemize}
   {\begin{itemize}\item}
   {\end{itemize}}

I suggest to load enumitem package. It has feature to create series, to suspend continue numeration from different list environments, and to customise the appearance of your environment in simple ways.

  • Thank you for clearing up my misunderstanding about \newenvironment ! That syntax clears up my confusion on that point. – PdfProfessionalPersonHere Dec 1 '13 at 7:39
  • Unfortunately, due to a problem of formatting, I think you misread my question. I'd like to have the default behavior, for every sentence or paragraph of sentences separated by a new line, set to assume a leading "\item" tag. In your example it just adds one item with a block of all text (and sub-enumerations/itemizations) – PdfProfessionalPersonHere Dec 1 '13 at 7:44
  • Preferably the leading tag would be \item\relax in case my users are weird and add [ at the beginning – PdfProfessionalPersonHere Dec 1 '13 at 8:00
0

Though I'm really late on this, the following can be used (but it replaces every \par in the environment paritem, even if it's inside a nested environment where you'd need that \par):

\documentclass[]{article}

\usepackage{environ,expl3}

\ExplSyntaxOn
\NewEnviron{paritem}{
  \ppph_parse_paritem:V \BODY
}

\tl_new:N \l_ppph_paritem_tl

\cs_new:Nn \ppph_parse_paritem:n {
  \tl_set:Nn \l_ppph_paritem_tl { #1 }
  \regex_replace_all:nnN { \c{par} } { \c{item} \c{relax} } \l_ppph_paritem_tl
  \begin{itemize}
    \item\relax
    \tl_use:N \l_ppph_paritem_tl
  \end{itemize}}

\cs_generate_variant:Nn \ppph_parse_paritem:n { V }
\ExplSyntaxOff

\begin{document}
\begin{paritem}
  foo
  \begin{paritem}
    shoot shoot

    the morning train
  \end{paritem}

  bar

  baz

  [stupid]
\end{paritem}
\end{document}

enter image description here

  • Couldn't you make use of \tex_everypar:D? – Manuel Oct 29 '17 at 8:11
  • @Manuel that doesn't work in my short test (only the first item gets the bullet point). – Skillmon Oct 29 '17 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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