![在章节首字母后面放置一个方框来风格化](https://linux22.com/image/355158/%E5%9C%A8%E7%AB%A0%E8%8A%82%E9%A6%96%E5%AD%97%E6%AF%8D%E5%90%8E%E9%9D%A2%E6%94%BE%E7%BD%AE%E4%B8%80%E4%B8%AA%E6%96%B9%E6%A1%86%E6%9D%A5%E9%A3%8E%E6%A0%BC%E5%8C%96.png)
答案1
下面是一个如何使用的示例lettrine
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage{lettrine}
\usepackage[svgnames]{xcolor}
\setcounter{DefaultLines}{3}
\begin{document}
\lettrine[findent=3pt, nindent=0pt, ante=\rlap{\color{LightSalmon!50}\rule[-0.55\LettrineHeight]{\LettrineWidth}{0.65\LettrineHeight}} ]{I}{n} former days -- that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.
\end{document}
答案2
只是为了好玩,我尝试使用 tikz 和 hangindent(只有一个段落)。
\documentclass{article}
\usepackage{tikz}
\newcommand{\bigletter}[2]% #1=number lines, #2=letter
{\sbox1{\resizebox{!}{\dimexpr #1\baselineskip-0.4\baselineskip}{#2}}%
\sbox0{%
\begin{tikzpicture}
\fill[red,opacity=.5] ({-0.5\wd1},{-0.3\ht1}) rectangle ({0.5\wd1},{.3\ht1});
\node[inner sep=0pt] {\usebox1};
\end{tikzpicture}}%
\hangindent=\dimexpr \wd0+2pt\relax
\hangafter=-#1
\noindent\llap{%
\raisebox{\dimexpr \baselineskip-#1\baselineskip}[0pt][0pt]{\usebox0}%
\hspace{2pt}}%
\strut\ignorespaces}
\begin{document}
\bigletter{3}{L}orem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus
eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Cura-
bitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue
eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim
rutrum.
\end{document}