更改 Goudy Initialen Lettrine 中的字母颜色

更改 Goudy Initialen Lettrine 中的字母颜色

梅威瑟:

\documentclass{book}
\usepackage{lettrine}
\usepackage{xcolor}

\input GoudyIn.fd
\newcommand*\initfamily{\usefont{U}{GoudyIn}{xl}{n}}

\begin{document}
\thispagestyle{empty}
\LARGE

\lettrine[lines=3,loversize=.25]{\color{olive}{\initfamily{I}}}{s} it possible to have the letter (in this case, \textit{I}) appear in black? 
\end{document}

产生显示的字母

在此处输入图片描述

我只想给字母赋予不同的颜色;在这种情况下,我想让字母以黑色显示,其他内容保持不变。在使用 编译代码时,有没有一种直接的方法可以做到这一点pdflatex?(我认为,也许使用\color{black}字母旁边的 可以做到这一点——但我错了。)

答案1

同时,为了获得多色调效果,将字符几乎(但不完全)完全叠印在其自身上可能是一种临时选择:

双色

并且可以对任何角色进行操作。

另外 - 使用 lua 可以应用渐变。

平均能量损失

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{lettrine}
\usepackage{xcolor}

\input{MorrisIn.fd}
\newcommand*\initfamily{\usefont{U}{MorrisIn}{xl}{n}}
\newlength{\goudycorr}
\newcommand{\egreglettrine}[1]{%
  \begingroup
  \setlength{\fboxsep}{0pt}%
  \fontsize{75}{0}\initfamily
  \colorbox{blue}{%
    \makebox[\height][c]{\color{yellow!40}#1}%
  }%
  \endgroup
}

\newcommand\eglett[2]{\sbox0{\egreglettrine{#1}}%
\lettrine[lines=6,loversize=0.85]{\colorbox{blue}{\usebox0}}{ #2}}

\begin{document}

\sbox0{\egreglettrine{T}}%
\lettrine[lines=5,loversize=0.55]{\colorbox{blue}{\usebox0}}{ he Lorem ipsum} \lipsum[3]

\eglett{O}{\bfseries nce} upon a time,  \lipsum[3]


\egreglettrine{A} 
  {\colorbox{yellow!40}{\color{blue}\fontsize{75}{0}\initfamily A}} 
  {\colorbox{yellow!40}{\color{blue}\fontsize{75}{0}\initfamily A}}\kern-0.35em\llap{{\color{red}\fontsize{75}{0}\initfamily A}} 

\end{document}


附录

作为一项侧面探索,TikZ 具有着色和定位功能。

TikZ 着色示例

平均能量损失

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{lettrine}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shadings} % ball
\usetikzlibrary{fadings,patterns}

\input{MorrisIn.fd}
\newcommand*\initfamily{\usefont{U}{MorrisIn}{xl}{n}}
\newlength{\goudycorr}
\newcommand{\egreglettrine}[1]{%
  \begingroup
  \setlength{\fboxsep}{0pt}%
  \fontsize{75}{0}\initfamily
  \colorbox{blue}{%
    \makebox[\height][c]{\color{yellow!40}#1}%
  }%
  \endgroup
}

\newcommand\eglett[2]{\sbox0{\egreglettrine{#1}}%
\lettrine[lines=6,loversize=0.85]{\colorbox{blue}{\usebox0}}{ #2}}


\newcommand\shadetext[2][]{%
  \setbox0=\hbox{{\special{pdf:literal 7 Tr }#2}}%
  \tikz[baseline=0]\path [#1] \pgfextra{\rlap{\copy0}} (0,-\dp0) rectangle (\wd0,\ht0);%
}

\input{Elzevier.fd}
\newcommand*\initfamilye{\usefont{U}{Elzevier}{xl}{n}}
\input{Zallman.fd}
\newcommand*\initfamilyz{\usefont{U}{Zallman}{xl}{n}}


\begin{document}

\sbox0{\egreglettrine{T}}%
\lettrine[lines=5,loversize=0.55]{\colorbox{blue}{\usebox0}}{ he Lorem ipsum} \lipsum[3]

\eglett{O}{\bfseries nce} upon a time,  \lipsum[3]






\egreglettrine{A} 
  {\colorbox{yellow!40}{\color{blue}\fontsize{75}{0}\initfamily A}} 
%
  {\colorbox{yellow!40}{\color{blue}\fontsize{75}{0}\initfamily A}}\kern-0.35em\llap{{\color{red}\fontsize{75}{0}\initfamily A}} 
%

\newpage
TikZ

%---
  {\colorbox{yellow!40}{\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamily A}};
    \node [text=black!80]at (0,0) (c) {\fontsize{75}{0}\initfamily A};
    \node at (0,0) (b2) [xshift=0.5pt,yshift=-0.5pt] {\shadetext[left color =red!80!yellow,middle color = blue!20, right color = blue!50]{\fontsize{75}{0}\initfamily A}};
    \end{tikzpicture}} 
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, text=yellow] (a) {\fontsize{75}{0}\initfamily A};
    \end{tikzpicture}
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, ball color=green] (a) {\fontsize{75}{0}\initfamily A};
    \end{tikzpicture}
%
\begin{tikzpicture}
\shade [left color=red,right color=blue] (-2,-1) rectangle (2,1);
\begin{scope}[transparency group=knockout]
\fill [white] (-1.9,-.9) rectangle (1.9,.9);
\node [opacity=0.2,font=\fontsize{75}{0}\initfamily]
{A};
\end{scope}
\end{tikzpicture}
%
\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamily A}};
    \end{tikzpicture}




\bigskip
%---
  {\colorbox{yellow!40}{\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamilye I}};
    \node [text=black!80]at (0,0) (c) {\fontsize{75}{0}\initfamilye I};
    \node at (0,0) (b2) [xshift=0.5pt,yshift=-0.5pt] {\shadetext[left color =red!80!yellow,middle color = blue!20, right color = blue!50]{\fontsize{75}{0}\initfamilye I}};
    \end{tikzpicture}} 
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, text=yellow] (a) {\fontsize{75}{0}\initfamilye I};
    \end{tikzpicture}
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, ball color=green] (a) {\fontsize{75}{0}\initfamilye I};
    \end{tikzpicture}
%
\begin{tikzpicture}
\shade [left color=red,right color=blue] (-2,-1) rectangle (2,1);
\begin{scope}[transparency group=knockout]
\fill [white] (-1.9,-.9) rectangle (1.9,.9);
\node [opacity=0.2,font=\fontsize{75}{0}\initfamilye]
{I};
\end{scope}
\end{tikzpicture}
%
\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamilye I}};
    \end{tikzpicture}





\bigskip
%---
  {\colorbox{yellow!40}{\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamilyz O}};
    \node [text=black!80]at (0,0) (c) {\fontsize{75}{0}\initfamilyz O};
    \node at (0,0) (b2) [xshift=0.5pt,yshift=-0.5pt] {\shadetext[left color =red!80!yellow,middle color = blue!20, right color = blue!50]{\fontsize{75}{0}\initfamilyz O}};
    \end{tikzpicture}} 
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, text=yellow] (a) {\fontsize{75}{0}\initfamilyz O};
    \end{tikzpicture}
%
\begin{tikzpicture}
    \node [left color =red,middle color = blue!50, right color = blue, ball color=green] (a) {\fontsize{75}{0}\initfamilyz O};
    \end{tikzpicture}
%
\begin{tikzpicture}
\shade [left color=red,right color=blue] (-2,-1) rectangle (2,1);
\begin{scope}[transparency group=knockout]
\fill [white] (-1.9,-.9) rectangle (1.9,.9);
\node [opacity=0.2,font=\fontsize{75}{0}\initfamilyz]
{O};
\end{scope}
\end{tikzpicture}
%
\begin{tikzpicture}
    \node (b) {\shadetext[left color =red,middle color = blue!50, right color = blue]{\fontsize{75}{0}\initfamilyz O}};
    \end{tikzpicture}



\end{document}

文本阴影代码来自:如何在 tikzpicture 中放置颜色渐变文本节点(绝对定位)

相关内容