# How to translate yinitial macro from TeX to LaTeX?

There is this macro in TeX.

In Yannis Haralambous' TUG Conference presentation in 1990, https://www.tug.org/TUGboat/tb12-1/tb31hara.pdf, in Initials, in page 132, he wrote:

To typeset the initial D of Appendix B, I used the macro \yinitial{D} as follows (with zero_depth:=false)

\def\yinitial#1
{\hangindent=2.54cm
\hangafter=-4
\hskip-3.24cm
\lower-2.7mm
\hbox{\yinit #1}
\hskip1.5mm}


How to translate this macro in a newcommand in LaTeX to write the beautiful initial D exactly as in Appendix B?

Of course, I already have font yinitas installed properly.

• Use the lettrine package. I would test if you'd provided an MWE.
– cfr
Feb 17, 2017 at 22:37
• There are packages already set up but they are not strictly needed, the code as posted should work (there is a typo in the last line 1.5mrn should be 1.5mm) Feb 17, 2017 at 23:19

I would use lettrine but to answer the question as asked, the code should work more or less as is in latex, I made a couple of spacing adjustments.

\documentclass{article}

\usepackage{kantlipsum}

\font\yinit=yinit at 15pt

\def\yinitial#1{%
\hangindent=2.54cm
\hangafter=-5
\hskip-3.24cm
\smash{\lower1.7cm \hbox{\yinit #1}}%
\hskip1.5mm
}

\begin{document}

\yinitial{D}\textsc{avid uses Yannis' code}. \kant[5]

\end{document}

• Nice answer @David Carlisle, the second letter should be out of the initial square and should be small, not necessarily capital. I try to mimic the initial in the image. Feb 18, 2017 at 0:11
• @tatojo just remove the \textsc and adjust the final \hskip to control where the normal text starts.... Feb 18, 2017 at 0:24
• Right @DavidCarlisle, now it is matter to adjust space. Feb 18, 2017 at 0:32

I wanted to point there is now an opentype version of this font, making it easier to scale and zoom in the viewer. The following example uses fontspec and can be compiled with xelatex or lualatex:

\documentclass[a4paper,12pt, twoside]{article}

\usepackage{fontspec}% font selecting commands%
\defaultfontfeatures{Numbers = {OldStyle, Proportional}, Ligatures = Rare, WordSpace = 1.1}%,2
\setmainfont{Minion Pro}%
\usepackage{polyglossia}
\setmainlanguage[variant = british]{english}%
\newfontface{\yinit}{Yinit}
\usepackage{parskip, nicefrac}

\usepackage[x11names]{xcolor}
\title{\color{Tomato2}\huge\bfseries\addfontfeatures{LetterSpace=1} TO MAKE AN AMBLONGUS PIE}
\author{\Large Edward Lear}
\date{}

\usepackage{lettrine}
\renewcommand{\DefaultLoversize}{0.1}
\setlength\DefaultFindent{0.1em}
\setlength\DefaultNindent{0.25em}
\renewcommand{\LettrineFontHook}{\color{Tan1}\yinit}

\begin{document}

\maketitle

\lettrine{T}{ake} 4 pounds (say 4 \nicefrac{1}{2} pounds) of fresh Amblongusses, and put them in a small pipkin.

\lettrine{C}{over} them with water and boil them for 8 hours incessantly, after which add 2 pints of new milk, and proceed to boil for 4 hours more.

\lettrine{W}{hen} you have ascertained that the Amblongusses are quite soft, take them out and place them in a wide pan, taking care to shake them well previously.

\lettrine{G}{rate} some nutmeg over the surface, and cover them carefully with powdered gingerbread, curry-powder, and a sufficient quantity of Cayenne pepper.

\lettrine{R}{emove} the pan into the next room, and place it on the floor. Bring it back again, and let it simmer for three-quarters of an hour. Shake the pan violently till all the Amblongusses have become a pale purple colour.

\lettrine{T}{hen}, having prepared a paste, insert the whole carefully, adding at the same time a small pigeon, 2 slices of beef, 4 cauliflowers, and any number of oysters.

\lettrine{W}{atch} patiently till the crust begins to rise, and add a pinch of salt from time to time.

\lettrine{S}{erve up} in a clean dish, and throw the whole out of the window as fast as possible.

\end{document}


• Looks nice, will try it! Feb 18, 2017 at 1:30
• @tatojo: The recipe? Feb 18, 2017 at 1:32
• Of course! Well, the font too! Feb 18, 2017 at 1:35

Use lettrine and adjust the parameters, taking into account that yinit is a big font.

\documentclass{article}
\usepackage{lettrine}
\usepackage{kantlipsum}

\renewcommand{\LettrineFontHook}{\usefont{U}{yinit}{m}{n}}
\setcounter{DefaultLines}{4}
\renewcommand{\DefaultLoversize}{-0.75}

\begin{document}

\lettrine{I}{t was} a dark and stormy night. \kant[5]

\end{document}


• Yes @egreg, actualy I got this output with \documentclass{article} \usepackage{yfonts} \usepackage{lipsum} \begin{document} \yinipar{L}orem ipsum \lipsum[2] \end{document} Feb 17, 2017 at 23:43
• @tatojo lettrine is much more customizable. Feb 17, 2017 at 23:44
• Right @egreg, its look like, I'll try that package. I supose you have yinitas font installed, isn' t? Feb 17, 2017 at 23:48
• @tatojo Yes, of course. Feb 17, 2017 at 23:54