![将文本放置在图像旁边](https://linux22.com/image/353676/%E5%B0%86%E6%96%87%E6%9C%AC%E6%94%BE%E7%BD%AE%E5%9C%A8%E5%9B%BE%E5%83%8F%E6%97%81%E8%BE%B9.png)
我正在关注这里给出的解决方案尝试达到此效果:
但这个解决方案没有成功。以下代码的输出如下:
您能帮我让文本显示在图形旁边,就像上面第一张图那样吗?
这是我目前拥有的代码:
\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}