Generalhow to properly define repeating layouts

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jvm985
Posts: 2
Joined: Wed Dec 27, 2023 5:32 pm

how to properly define repeating layouts

Post by jvm985 »

Dear members
I would like to define some commands that would allow me to easily insert repeating parts in my text. These parts have the same layout, but different content. I know how to define commands and how to pass arguments, but I am not a good latex programmer at all, so I wondered if there's an easy way.

This is an example of such a layout:

Code: Select all

\begin{minipage}[t]{0.5\linewidth}
	\textbf{You can:}
	\begin{itemize}[leftmargin=*]
		\item identify causes of A
		\item explain differences between A and B
	\end{itemize}
\end{minipage}\hspace{0.1\textwidth}%
\begin{minipage}[t]{0.4\linewidth}
	\textbf{Vocabulary}
	\begin{itemize}[leftmargin=*]
		\item A
		\item B
		\item C
	\end{itemize}
\end{minipage}
I would like to be able to write something like:

Code: Select all

\things_to_know{ {identify causes of A, explain differences between A and B}, {A, B, C} }
or even:

Code: Select all

\begin{stuff_to_know}
  \item identify causes
  \item explain
  >>>>>>>
  \item A
  \item B
  \item C
\end{stuff_to_know}
Thanks very much for any advice or links. I've looked around the internet, but I am afraid I couldn't really find useful information.
Last edited by jvm985 on Thu Dec 28, 2023 1:52 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

how to properly define repeating layouts

Post by rais »

Hi,
I'm not sure if you want the same `You can:' and `Vocabulary' statements, but a first attempt might look something like:

Code: Select all

\documentclass{article}
\usepackage{enumitem}% just a guess...
\usepackage{showframe}% just for demo
\newenvironment{stuffIIknow}{%
  \providecommand*\switchtosndstuff{%
    \end{itemize}
    \end{minipage}%
    \hfill
    \begin{minipage}[t]{0.4\linewidth}
    \textbf{Vocabulary}
    \begin{itemize}[leftmargin=*]
  }%\switchtosndstuff
  \noindent\begin{minipage}[t]{0.5\linewidth}
  \textbf{You can:}
  \begin{itemize}[leftmargin=*]
}{%
  \end{itemize}
  \end{minipage}%
}
\begin{document}
\begin{stuffIIknow}
  \item identify causes
  \item explain
\switchtosndstuff
  \item A
  \item B
  \item C
\end{stuffIIknow}
\end{document}
KR
Rainer
jvm985
Posts: 2
Joined: Wed Dec 27, 2023 5:32 pm

how to properly define repeating layouts

Post by jvm985 »

That is exactly what I was looking for! Thanks very much.
Post Reply