![缩进所有段落](https://linux22.com/image/366183/%E7%BC%A9%E8%BF%9B%E6%89%80%E6%9C%89%E6%AE%B5%E8%90%BD.png)
我想创建一个由图像(左侧的框)缩进的文本块(右侧的框)。
我不知道如何或用什么来实现这种效果,我最接近的方法是使用以下代码:
\documentclass[a4paper]{article}
\usepackage[czech]{babel}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {img/} }
\def\pictureSize{0.15\textwidth}
\begin{document}
\section*{Experience}
\begin{minipage}{\dimexpr\textwidth}
\hfill
\begin{wrapfigure}{l}{\pictureSize}
\includegraphics[width=\pictureSize]{image}
\end{wrapfigure}
\begin{minipage}{\dimexpr\textwidth-\pictureSize}
\large
\textbf{Title}\par
\large
Subtitle\par
\normalsize
More info\par
\bigskip
Multi-line
text.
\end{minipage}
\end{minipage}
\end{document}
问题在于它将图像与整个部分的底部对齐。
答案1
这里有两个解决方案:一个使用adjustwidth
来自changepage
另一个的环境的简单minpage
和 plainTeX 宏包insbox
。
后者代码简单一些,但是会跨页跳转,前者则可以。
\documentclass[a4paper, czech, twwoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{garamondx}
\usepackage[showframe]{geometry}
\usepackage{babel}
\usepackage{changepage, lettrine}
\usepackage{wrapfig}
\usepackage{graphicx}
\input{insbox}
\graphicspath{ {img/} }
\def\pictureSize{0.15\textwidth}
\begin{document}
\section*{Experience}
\begin{adjustwidth}{0.15\textwidth}{0pt}
\leavevmode\llap{\raisebox{\dimexpr-\height + 1.5ex}[0pt][0pt]{\includegraphics[width = \dimexpr0.15\textwidth-\marginparsep]{humpty-dumpty}}\hspace{\dimexpr\marginparsep}}%
However, the egg only got larger and larger, and more and more human:
when she had come within a few yards of it, she saw that it had eyes
and a nose and mouth; and when she had come close to it, she saw clearly
that it was HUMPTY DUMPTY himself. ‘It can’t be anybody else!’ she said
to herself. ‘I’m as certain of it, as if his name were written all over
his face.’
It might have been written a hundred times, easily, on that enormous
face. Humpty Dumpty was sitting with his legs crossed, like a Turk, on
the top of a high wall--such a narrow one that Alice quite wondered how
he could keep his balance--and, as his eyes were steadily fixed in the
opposite direction, and he didn’t take the least notice of her, she
thought he must be a stuffed figure after all.
‘And how exactly like an egg he is!’ she said aloud, standing with her
hands ready to catch him, for she was every moment expecting him to
fall.
‘It’s VERY provoking,’ Humpty Dumpty said after a long silence, looking
away from Alice as he spoke, ‘to be called an egg--VERY!’
‘I said you LOOKED like an egg, Sir,’ Alice gently explained. ‘And some
eggs are very pretty, you know’ she added, hoping to turn her remark
into a sort of a compliment.
‘Some people,’ said Humpty Dumpty, looking away from her as usual, ‘have
no more sense than a baby!’
\end{adjustwidth}
\bigskip
\section*{Experience}%
\InsertBoxL{0}{\fbox{\includegraphics[width = 0.12\textwidth]{humpty-dumpty}}}
\begin{minipage}[t]{0.80\textwidth}
However, the egg only got larger and larger, and more and more human:
when she had come within a few yards of it, she saw that it had eyes
and a nose and mouth; and when she had come close to it, she saw clearly
that it was HUMPTY DUMPTY himself. ‘It can’t be anybody else!’ she said
to herself. ‘I’m as certain of it, as if his name were written all over
his face.’
It might have been written a hundred times, easily, on that enormous
face. Humpty Dumpty was sitting with his legs crossed, like a Turk, on
the top of a high wall--such a narrow one that Alice quite wondered how
he could keep his balance--and, as his eyes were steadily fixed in the
opposite direction, and he didn’t take the least notice of her, she
thought he must be a stuffed figure after all.
‘And how exactly like an egg he is!’ she said aloud, standing with her
hands ready to catch him, for she was every moment expecting him to
fall.
‘It’s VERY provoking,’ Humpty Dumpty said after a long silence, looking
away from Alice as he spoke, ‘to be called an egg--VERY!’
‘I said you LOOKED like an egg, Sir,’ Alice gently explained. ‘And some
eggs are very pretty, you know’ she added, hoping to turn her remark
into a sort of a compliment.
‘Some people,’ said Humpty Dumpty, looking away from her as usual, ‘have
no more sense than a baby!’
\end{minipage}
\end{document}
答案2
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{center}
\begin{minipage}[t]{2cm}
\vspace{-5pt}\includegraphics[width=\linewidth]{example-image}
\end{minipage}\hfill
\begin{minipage}[t]{\dimexpr\textwidth-2cm-10pt}
\def\s{Something Something Something Something Something Something Something Something }
\s\s\s. Red green blue. \s\s\s\
\end{minipage}
\end{center}
\begin{center}
\begin{minipage}[t]{2cm}
\vspace{-5pt}\includegraphics[width=\linewidth]{example-image}
\end{minipage}\hfill
\begin{minipage}[t]{\dimexpr\textwidth-2cm-10pt}
\def\s{Something else Something else Something else Something else Something else Something else Something else Something else }
\s\s\s. Red green blue. \s\s\s\
\end{minipage}
\end{center}
\end{document}