1

The main question is, how can this be done with an environment? (Because I think that this would be the right way)

I want some parts to always have the same look. Have I done this right? Or should/can \newenvironment be used (if so, I don't know how). Would you generally recommend an other layout? Maybe something different than \subsection*? I thought about a table, but the descriptions of the characteristics are "very" long... .

My attempt, but I have to write characteristic1 (and so on) every time

\documentclass[preview, border={10pt}]{standalone}
\usepackage{lipsum}

\newcommand{\typ}[4]{\subsection*{typ: #1}%
\begin{description}%
\item[characteristic1] #2%
\item[characteristic2] #3%
\item[characteristic3] #4%
\end{description}}%

\newenvironment{typEnvironment}[1]%
{%
\subsection*{typ: #1}%
\description%
}%
{%
\enddescription%
}%

\begin{document}

\typ{title}{\lipsum[4]}{\lipsum[4]}{\lipsum[4]}

\begin{typEnvironment}{title}
\item[characteristic1] \lipsum[4]
\item[characteristic2] \lipsum[4]
\item[characteristic3] \lipsum[4]
\end{typEnvironment}

\end{document}
  • The content is imho okay, I would always prefer a list over a table if possible, but I would probably use an environment and not a command. – Ulrike Fischer Aug 17 '17 at 22:04
  • How can that be done with an environment? I only know how to set the part over and under the body, but the body itself has something to do with \item[characteristic1] #2 and so on – Ben Aug 17 '17 at 22:09
  • 2
    Well, this is something like a new list environment then, which can be defined easily with \newlist from enumitem – user31729 Aug 17 '17 at 22:37
  • @UlrikeFischer Wondering if you would mind telling me whether \begin{} and \end{} should be avoided in definitions of environments generally? (See OP's comment on my answer.) If so, is there somewhere which explains why? – cfr Aug 18 '17 at 0:31
2

Something like this?

description as enumeration

\documentclass{article}
\usepackage{enumitem,lipsum}

\newenvironment{typEnvironment}[1]%
{%
  \subsection*{typ: #1}\par
  \begin{typList}%
}%
{%
  \end{typList}%
}%
\newlist{typList}{enumerate}{1}
\setlist[typList]{label=characteristic\arabic*,font=\bfseries,wide,align=left,labelindent=0pt}
\begin{document}
\begin{typEnvironment}{title}
  \item \lipsum[4]
  \item \lipsum[4]
  \item \lipsum[4]
\end{typEnvironment}
\end{document}
| improve this answer | |
  • Normally something like \typListand \endtypListshould be used inside the environment-definition, am I right? And I guess the package enumitem doesn't provide this by default? – Ben Aug 18 '17 at 0:12
  • @Ben I'm not sure. Why should that be used? There are some cases where you can't use the \begin{} \end{} syntax inside, but I wasn't aware that it is a general rule. Do you have a reference? – cfr Aug 18 '17 at 0:28
  • I read that on StackExchange, but no idea where. Something like "Do not use several scopes, if not needed" – Ben Aug 18 '17 at 11:24
  • 1
    I'm referencing to the second paragraph of this answer. – Ben Aug 18 '17 at 11:31
  • @Ben I'm not sure about that advice generally, but here you do want an additional group for the list, because the list is distinct from the sectioning command. However, you could use the \typList ... \endtypList if you prefer. Really, I don't know. It might be worth asking as a separate question, if it hasn't been asked already. If you don't ask, maybe I will. (If you do ask it, can you put a link here in the comments, so I don't duplicate it?) – cfr Aug 18 '17 at 17:28

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.