我想制作一个两列文档,第一列是文本,第二列是带有文本示例的图片。我该怎么做?
答案1
如果您喜欢tufte-handout
或tufte-book
默认样式,这些文档类就是您要找的。如果您知道如何根据自己的喜好调整此样式,那么它可能也是一个不错的选择,就像这种“去簇绒” MWE 一样。在其他情况下,评论中已经回答了这个问题。
\documentclass[nofonts,nols,justified]{tufte-handout}
\usepackage{mwe} % for demo images
\usepackage{graphicx}
\setcounter{secnumdepth}{3}
\setcaptionfont{\itshape\sffamily}
\usepackage{titlesec}
\titleformat{\section}
{\color{blue!80!black}\normalfont\Large\bfseries}
{\color{blue!60!black}\thesection.}{.5em}{}
\begin{document}
\section{Lore ipsum}
\lipsum*[2] (See figure \ref{a}).
\begin{marginfigure}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Some clever caption\label{a}}
\end{marginfigure}
\lipsum[1]
\section{Na dui ligula (figure \ref{b})}
\begin{marginfigure}
\includegraphics[width=\textwidth]{example-image-b}
\caption{Some clever caption\label{b}}
\end{marginfigure}
See figure \ref{c}. \lipsum[3]
\begin{marginfigure}
\includegraphics[width=\textwidth]{example-image-16x10}
\caption{Some clever caption\label{c}}
\end{marginfigure}
\end{document}
答案2
此解决方案基于 paracol。它将图形底部与插入点对齐。居中会比较棘手。
\documentclass{article}
\usepackage{graphicx}
\usepackage{paracol}
\usepackage{lipsum}% MWE only
\setcolumnwidth{0.6\textwidth}% last column uses what is left
\makeatletter
\newenvironment{insertfigure}{\switchcolumn[1]\null\vfill% align bottom to insertion point
\begin{minipage}{\columnwidth}% no floating
\def\@captype{figure}}{\end{minipage}\switchcolumn[0]*}
\makeatother
\begin{document}
\begin{paracol}{2}
\section{Lore ipsum}
\lipsum*[2] (See figure \ref{a}).
\begin{insertfigure}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Some clever caption\label{a}}
\end{insertfigure}
\lipsum[1]
\section{Na dui ligula (figure \ref{b})}
\begin{insertfigure}
\includegraphics[width=\textwidth]{example-image-b}
\caption{Some clever caption\label{b}}
\end{insertfigure}
See figure \ref{c}. \lipsum[3]
\begin{insertfigure}
\includegraphics[width=\textwidth]{example-image-16x10}
\caption{Some clever caption\label{c}}
\end{insertfigure}
\end{paracol}
\end{document}