首字母大并插入下一行?

首字母大并插入下一行?

在此处输入图片描述

如何拼出那个“F”。我也在使用这个multicol

答案1

您可以使用该包lettrine来完成这项工作。

\documentclass{book}
\usepackage{newtxtext} % you want true small caps
\usepackage{lettrine}

\begin{document}

\chapter{Beginning}

\lettrine{F}{ew would quarrel} about the correct way to break boiled
eggs, but, as you probably know, there was even a civil war caused
by this very important question in the island of Lilliput. You may
also know that computer scientists took the names \emph{big-endian}
and \emph{little-endian} from Swift's `Gulliver's travels'.

\end{document}

在此处输入图片描述

但你似乎想要一个稍微不同的输出,莱特林(法语中意为“首字下沉”)向上突出。如果你输入

\lettrine[loversize=0.5]{F}{ew would quarrel}

那么输出将是

在此处输入图片描述

但不需要loversize=0.5每次都添加。只需在文档前言中添加适当的设置即可。

\documentclass{book}
\usepackage{newtxtext} % you want true small caps
\usepackage{lettrine}

% lettrine settings
\renewcommand*{\DefaultLoversize}{0.5}
%%%

\begin{document}

\chapter{Beginning}

\lettrine{F}{ew would quarrel} about the correct way to break boiled
eggs, but, as you probably know, there was even a civil war caused
by this very important question in the island of Lilliput. You may
also know that computer scientists took the names \emph{big-endian}
and \emph{little-endian} from Swift's `Gulliver's travels'.

\end{document}

在此处输入图片描述

个人观点:我永远不会使用首字下沉次。

答案2

注:参见“使用 LaTeX 排版删除大写字母“ 也可以看看 ”如何增加章节中第一个字符的大小(Drop-Caps)

我已经使用 lettrine 包有一段时间了:

\usepackage{lettrine}

我通过一个简单的定义使 lettrine 包可用:

%___________ Define \plett ____________
\makeatletter
\def\plett#1{%
\StrLeft{#1}{1}[\myfirstletter]%
\StrGobbleLeft{#1}{1}[\myrestofword]
\lettrine[lines=3]{\myfirstletter}{\trimright{\myrestofword}}
}
\makeatother

我发现,[lines=3]例如,下沉大写字母的高度和行数可以满足我的大部分需求,而且可以轻松调整。

如何应用\plett代码的典型示例是:

\plett{Fire can exist} in many forms. Over the course of human history, we have utilized fire in it’s many likenesses to accomplish what we otherwise could not. \par

为了增加效果,我调整了初始字符的颜色,如下所示:

\renewcommand{\LettrineFontHook}{\color{BrickRed}}  % See LaTeX/Colors

我将 BrickRed 定义为:

\definecolor{BrickRed}{RGB}{144,44,30} 

最后,我添加了\trimright函数(来自 SE发帖) 在函数中调用\plett(参见 MWE 中的“定义 \trimleft & \trimright”)。

%_________________________________________

\documentclass{article}
\usepackage{lettrine}
\usepackage{libertine}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{xstring}


\definecolor{BrickRed}{RGB}{144,44,30} 

%___________ Define \plett ____________
    \makeatletter
    \def\plett#1{%
    \StrLeft{#1}{1}[\myfirstletter]%
    \StrGobbleLeft{#1}{1}[\myrestofword]
    \lettrine[lines=3]{\myfirstletter}{\trimright{\myrestofword}}
    }
    \makeatother

%________ Define \trimleft & \trimright _______
% Trimming whitespace around text (like LTRIM, RTRIM and TRIM)
\begingroup
  %
  % This plain TeX code uses the prefix "tsp", and defines
  % \trim, \trimleft, and \trimright.
  %
  \catcode`@=11
  \long\gdef\trim#1{\trimleft{\trimright{#1}}}
  %
  % Trimming spaces on the right is done by repeatedly calling \unskip
  % until \lastskip is zero.  We start with \hskip0pt\relax to stop
  % \trimright from trimming spaces _before_ #1 in case this only
  % contains spaces.
  %
  \long\gdef\trimright#1{\hskip0pt\relax #1\tsp@right}
  \gdef\tsp@right
    {\unskip\ifdim0pt=\lastskip\else\expandafter\tsp@right\fi}
  %
  % Trimming spaces on the left is done by repeatedly using \futurelet
  % to test the first token, and dispatching depending on what is found.
  % Expandable tokens are expanded; most assignments are performed;
  % spaces are ignored; groups are entered.  The loop ends when
  % encountering \tsp@left@end.
  %
  \long\gdef\trimleft#1{\tsp@left#1\tsp@left@end}
  \global\let\tsp@left@end\relax
  \gdef\tsp@left{\expandafter\tsp@left@look}
  \gdef\tsp@left@look{\futurelet\tsp@token\tsp@left@test}
  \gdef\tsp@left@test
    {%
      \typeout{\meaning\tsp@token}%
      \expandafter\ifx\noexpand\tsp@token\tsp@token
        \expandafter\@secondoftwo
      \else
        \expandafter\@firstoftwo
      \fi
      {% Expandable token => expand again.
        \let\tsp@next\tsp@left
      }%
      {%
        \ifcat\tsp@token\relax
          % Non-expandable primitive: build \tsp@<meaning>.
          % Note that primitives for which I haven't defined
          % \tsp@<meaning> just give \relax, which stops
          % trimming cleanly.
          \begingroup
            \escapechar-1%
            \global\expandafter\let\expandafter\tsp@next
              \csname tsp@\meaning\tsp@token\endcsname
          \endgroup
        \else
          % Character token.
          \ifcat\tsp@token\bgroup % Begin-group: do; continue trimming
            \bgroup\let\tsp@next\tsp@gobble@token
          \else
            \ifcat\tsp@token\egroup % End-group: do; continue trimming
              \egroup\let\tsp@next\tsp@gobble@token
            \else
              \ifcat\tsp@token\space % Space: remove; continue trimming
                \let\tsp@next\tsp@gobble@token
              \else % Anything else: stop trimming
                \let\tsp@next\relax
              \fi
            \fi
          \fi
        \fi
      }%
      \tsp@next
    }%
  \gdef\tsp@gobble@token{\afterassignment\tsp@left\let\tsp@token= }
  %
  % Helpers for defining primitives.
  %
  \long\gdef\tsp@swap#1{#1\tsp@gobble@token}
  \gdef\tsp@assignment{\afterassignment\tsp@left}
  %
  % Various primitives
  %
  \global \let \tsp@unskip     \tsp@gobble@token
  \global \expandafter \let \csname tsp@ \endcsname \tsp@gobble@token
  \global \let \tsp@begingroup \tsp@swap
  \global \let \tsp@endgroup   \tsp@swap
  \global \let \tsp@def        \tsp@assignment
  \global \let \tsp@edef       \tsp@assignment
  \global \let \tsp@gdef       \tsp@assignment
  \global \let \tsp@xdef       \tsp@assignment
  \global \let \tsp@let        \tsp@assignment
  \global \let \tsp@futurelet  \tsp@assignment
  \global \let \tsp@global     \tsp@assignment
  \global \let \tsp@long       \tsp@assignment
  \global \let \tsp@protected  \tsp@assignment
  \gdef\tsp@hskip#1{\begingroup\afterassignment\tsp@hskip@\skip0= }
  \gdef\tsp@hskip@{\endgroup\tsp@left}
  %
  % We must end when seeing \tsp@left@end (normally \relax)
  %
  \long\gdef\tsp@relax#1%
    {%
      \begingroup
        \def\tsp@left@end{\tsp@left@end}%
        \expandafter
      \endgroup
      \ifx#1\tsp@left@end
      \else
        \expandafter\tsp@left
      \fi
    }
\endgroup

\begin{document}

\renewcommand{\LettrineFontHook}{\color{BrickRed}}  % See LaTeX/Colors
\renewcommand{\LettrineTextFont}{\rmfamily}
% \renewcommand*{\LettrineTextFont}{\scshape}   % for French

 \plett{Fire can exist} in many forms. Over the course of human history, we have utilized fire in it’s many likenesses to accomplish what we otherwise could not. \par

\end{document}
%_________________________________________

效果很好!

lettrine 包中有多个用于省略大写字母的选项。

相关内容