将文本放置在图像旁边

将文本放置在图像旁边

我正在关注这里给出的解决方案尝试达到此效果: 在此处输入图片描述

但这个解决方案没有成功。以下代码的输出如下:

在此处输入图片描述

您能帮我让文本显示在图形旁边,就像上面第一张图那样吗?

这是我目前拥有的代码:

\documentclass{article}
\usepackage{graphicx}

\newcommand*{\authorimg}[1]{%
  \raisebox{-.3\baselineskip}{%
    \includegraphics[
      height=\baselineskip,
      width=\baselineskip,
      keepaspectratio,
    ]{#1}%
  }%
}

\begin{document}
\begin{itemize}
\item[\authorimg{example-image-a}] FONTS\\The range of fonts on your\\
computer is often highly distinctive\\(unless you only have the fonts\\the machine came with)
\item[\authorimg{example-image-b}] SCREEN SIZE\\Though easily switched, this\\setting can be a useful aspect of\\your devices's fingerprint
\end{itemize}
\end{document}

答案1

像这样吗?

字体

\documentclass[]{article}
\usepackage{graphicx,array}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}
    \begin{tabular}{C{2.8cm}  L{5.5cm}}
        \includegraphics[width=\linewidth]{example-image-a} & FONTS \newline 
        The range of fonts on your computer is often highly distinctive (unless you only have the fonts the machine came with) \\
        \includegraphics[width=\linewidth]{example-image-a} & SCREEN SIZE \newline 
        Though easily switched, this setting can be a useful aspect of your device's fingerprint \\
        \includegraphics[width=\linewidth]{example-image-a} & SOFTWARE \newline 
        Do you have an art director's toolkit or are you an unrepentant gamer? Or both?
    \end{tabular}
\end{document}

我固定了两列的宽度,以便重现类似于你所拥有的东西,解决方案参考这里。这些允许通过 进行手动换行\newline,这是我以前从FONTS等进行换行的方式。

答案2

在此处输入图片描述

miniage仅在第一项中使用:

\documentclass{article}
\usepackage{graphicx}

\newcommand*{\authorimg}[1]{%
  \raisebox{-.3\baselineskip}{%
    \includegraphics[
      height=\baselineskip,
      width=\baselineskip,
      keepaspectratio,
    ]{#1}%
  }%
}

\begin{document}
\begin{itemize}
\item[\authorimg{example-image-a}] \begin{minipage}{\dimexpr\linewidth-2\baselineskip\relax}
                                    FONTS\\The range of fonts on your\\
                                    computer is often highly distinctive\\
                                    (unless you only have the fonts\\
                                    the machine came with)
                                    \end{minipage}
\item[\authorimg{example-image-b}] SCREEN SIZE\\Though easily switched, this\\setting can be a useful aspect of\\your devices's fingerprint
\end{itemize}
\end{document}

附录:要获得更大的图像,您需要

  • 定义更大labelwidth(该图像在标签中有空间)
  • 图像大小适应标签宽度

例如,该图像大小应等于4\baselineskip您可以在 MWE 上方进行如下更改:

\documentclass{article}
\usepackage{graphicx}
\usepackage{enumitem}

\newcommand*{\authorimg}[1]%
    { \raisebox{-1\baselineskip}{\includegraphics[width=\imagesize]{#1}}}
\newlength\imagesize    % new lwngth for determining image size and label width

\begin{document}
\begin{itemize}[leftmargin=1.2\imagesize,labelwidth=\imagesize]% left margin is 20% bigger than label width
    \setlength\imagesize{4\baselineskip}
\item[\authorimg{example-image-a}] \begin{minipage}{\dimexpr\textwidth-1.2\imagesize\relax}
                                    FONTS\\
                                    The range of fonts on your\\
                                    computer is often highly distinctive\\
                                    (unless you only have the fonts\\
                                    the machine came with)
                                    \end{minipage}
\end{itemize}
\end{document}

在此处输入图片描述

相关内容