While drafting a text, I want to subdivide and group text pieces and keywords to easily reorder them throughout the document.
Examples for such a group of text pieces would be:
Example 1): Two arguments (2nd is optional and multi-line)
Having in the LaTeX file something like…
\mycommand{Summary of this paragraph (always provided)} {
optional textline 1
optional textline 2
...
}
…should result in the pdf as…
Summary of this paragraph (always provided)
- optional textline 1
- optional textline 2
- …
Example 2): One argument
Having in the LaTeX file something like…
\mycommand{Summary of this paragraph (always provided)}
…should result (without optional arguments) in the pdf as…
Summary of this paragraph (always provided)
I tried already some things with \newcommand
but I'm not a real expert.
The needed features would be
\mycommand
gets at least one argument and prints this to the PDF (e.g. in bold letters)\mycommand
takes a variable number of following lines (in parenthesis) as second argument and adds for each new line an\item
to an\itemize
list (without writing the\item
in the.tex
-file)- Changing the
\mycommand
to display only text would then finally generate a running text without the need of removing the\item
commands.
Any help appreciated.
Best Answer
You can profit of
xparse
and LaTeX3 functions.