1

I would like to describe icons in a column- or table-wise layout. In my opinion a table is not the best tool for this task:

\documentclass{scrreprt}
\usepackage{blindtext, longtable, tabu}
\begin{document}
\begin{longtabu} [c] {lX}
\hline
\rule{4cm}{4cm} & \blindtext \\ 
\rule{4cm}{2cm} & \blindtext\blindtext \\ 
\rule{2cm}{4cm} & \blindtext \\ 
\rule{2cm}{2cm} & \blindtext \\ 
\hline
\end{longtabu}
\end{document}

I took a look in documentations of LaTeX packages and saw the macro \DeclareMacro{} to document macros. Unfortunately, I did not find the source code of this macro, because I think this would be a good starting point for my task.

How would you describe icons with a similar layout? Is it possible to use a column environment?

  • How big are the icons? – user11232 May 4 '15 at 8:26
  • Mostly small, like 1-2cm per width and height. However, I would like to use the layout with icons which are as big as the rules in the MWE. – Dirk May 4 '15 at 8:32
3

You can use a list like itemize

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{enumitem}
\newcommand{\myicon}[1]{\smash{\raisebox{-0.85\height}{\includegraphics[width=15mm]{#1}}}}
\begin{document}

\blindtext

\begin{itemize}[leftmargin=*]
\item Test
\item Test
\end{itemize}

\blindtext

\begin{itemize}
\item[\myicon{example-image}] \blindtext 
\item[\myicon{example-image-a}] \blindtext\blindtext 
\item[\myicon{example-image-b}]  \blindtext 
\item[\myicon{example-image}] \blindtext 
\end{itemize}
\end{document}

enter image description here

As noted by egreg, you can load adjustbox package with export option, then certain keys (like valign) become available for \includegraphics. Here is the sample.

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage[export]{adjustbox}
\usepackage{enumitem}

\newcommand{\myicon}[1]{\includegraphics[width=15mm,valign=t,set depth=0pt]{#1}}
\begin{document}
\begin{itemize}
\item[\myicon{example-image}] \blindtext
\item[\myicon{example-image-a}] \blindtext\blindtext
\item[\myicon{example-image-b}]  \blindtext
\item[\myicon{example-image}] \blindtext
\end{itemize}
\end{document}

Or with paracol

\documentclass{scrreprt}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{paracol}
\newcommand{\myicon}[1]{\includegraphics[width=0.8\linewidth]{#1}}
\newcommand{\myicons}[2]{%
\columnratio{0.35}
\begin{paracol}{2}
\myicon{#1}
\switchcolumn
#2
\end{paracol}
}

\begin{document}
\myicons{example-image}{\blindtext}
\myicons{example-image-a}{\blindtext\blindtext}
\myicons{example-image-b} {\blindtext}
\myicons{example-image}{\blindtext}
\end{document}

enter image description here

  • 1
    Instead of \smash you could use adjustbox and its valign=t option; if you do \usepackage[export]{adjustbox}, then you can directly say \includegraphics[width=15mm,valign=t,set depth=0pt]{filename} – egreg May 4 '15 at 8:46
  • I hope you also tested it. ;-) – egreg May 4 '15 at 8:54
  • @egreg Is there anything wrong? If you say some thing, I am of the opinion that I need not check. :-). I have tested it for sure. – user11232 May 4 '15 at 8:55
  • Thanks! I like your itemize solution. However, when I add some text before the item list, the icons are in the margin. I edit your first code, I hope that was ok. – Dirk May 4 '15 at 9:44
  • 1
    @Dirk Difficult to predict with little information. May be ask a new question with full details? – user11232 May 4 '15 at 12:52

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.