使用lettrine
可能不是我所期望的类型会导致我遇到问题。运行以下示例时,您可以看到两行文本不是从同一位置开始的。太丑了!我希望并相信有一种解决方法可以获得智能且类似 LaTeX 的结果。
\documentclass{scrartcl}
\usepackage{lettrine}
\usepackage{tikz}
\setlength{\textwidth}{5cm}
\begin{document}
\lettrine{\tikz\fill[red] (0,0) rectangle (1ex,2ex);}{} This is just
a ridiculous test. This is just a ridiculous test. This is just a
ridiculous test. This is just a ridiculous test.
\end{document}
备注:在我的应用程序中没有红色矩形,但有一本打开的书作为文献交叉引用的提示。
答案1
来自文档的lettrine
:
findent=<dimen>
(正数或负数)控制放下的大写字母和缩进的文本块之间的水平间隙(默认值=0pt);
nindent=<dimen>
从第二行开始,水平移动所有缩进的行<dimen>
(此移动相对于第一行,默认值=0.5em);
然后可以使用以下设置,例如:
\documentclass{scrartcl}
\usepackage{lettrine}
\usepackage{tikz}
\setlength{\textwidth}{5cm}
\begin{document}
\lettrine[
findent=.5em,
nindent=0pt
]{\tikz\fill[red] (0,0) rectangle (1ex,2ex);}{}% comment line end (space)
This is just
a ridiculous test. This is just a ridiculous test. This is just a
ridiculous test. This is just a ridiculous test.
\end{document}
答案2
您说过,您将在 lettrine 中使用图像。然后您需要以下内容:
\lettrine[
lines=2,
lraise=0.05, %% raises or lowers (for -ve value) image
findent=.5em, %% controls the gap between image and the text
image=true]{example-image-a}{This}
此处的选项image=true
允许您放置图像(example-image-a
此处}。请注意,第二个参数包含This
,为了防止该词更改其字体,您必须使用
\renewcommand{\LettrineTextFont}{\normalfont}
代码:
\documentclass{scrartcl}
\usepackage{lettrine}
\usepackage{graphicx}
\setlength{\textwidth}{5cm}
\renewcommand{\LettrineTextFont}{\normalfont}
\begin{document}
\lettrine[
lines=2,
lraise=0.05,
findent=.5em,
image=true]{example-image-a}{This} is just
a ridiculous test. This is just a ridiculous test. This is just a
ridiculous test. This is just a ridiculous test.
\end{document}
答案3
像那样?
\documentclass{scrartcl}
\usepackage{lettrine}
\usepackage{tikz}
\setlength{\textwidth}{5cm}
\begin{document}
\lettrine[nindent = 0em]{\tikz\fill[red] (0,0) rectangle (1ex,2ex);\,}{}This is just a ridiculous test. This is just a ridiculous test. This is just a
ridiculous test. This is just a ridiculous test.
\end{document}