Lettrine + string manipulation + some fonts = errors and weird issuesLettrine package and the letter LLettrine and section at bottom of page causes bad pagebreakLettrine, accentuated characters and htlatexLettrine and WrapfigLettrine and Arabic scriptCapital letters and lettrineIssue: string manipulation with links insideConflict between lettrine and justifyHow to use lettrine with diacritics and makebox?midsloppy and lettrine do not play nice
A food item only made possible by time-freezing storage?
How to conceptualize Newton's apple?
Social leper versus social leopard
A delve into extraordinary chess problems: Selfmate 1
Designing a time thief proof safe
Draw a horizontal line from the left margin to the end of centered text
Comma Code - Automate the Boring Stuff with Python
Is it possible to encode a message in such a way that can only be read by someone or something capable of seeing into the very near future?
What benefits does the Power Word Kill spell have?
Do we know the situation in Britain before Sealion (summer 1940)?
What is the need of methods like GET and POST in the HTTP protocol?
Line segments inside a square
Does "as soon as" imply simultaneity?
Is there any iPhone SE out there with 3D Touch?
Building a nine - region cluster chart with Tooltip to display labels associated with 2D points
Can Northern Ireland's border issue be solved by repartition?
How do pilots align the HUD with their eyeballs?
Strange Sticky Substance on Digital Camera
Is it impolite to ask for an in-flight catalogue with no intention of buying?
What exactly did this mechanic sabotage on the American Airlines 737, and how dangerous was it?
Extruding snaps back
How do I set a custom order for folders on Windows 7 and 10?
1, 2, 4, 8, 16, ... 33?
To what extent is it worthwhile to report check fraud / refund scams?
Lettrine + string manipulation + some fonts = errors and weird issues
Lettrine package and the letter LLettrine and section at bottom of page causes bad pagebreakLettrine, accentuated characters and htlatexLettrine and WrapfigLettrine and Arabic scriptCapital letters and lettrineIssue: string manipulation with links insideConflict between lettrine and justifyHow to use lettrine with diacritics and makebox?midsloppy and lettrine do not play nice
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am encountering some weird behavior and errors when manipulating strings inside of lettrine arguments: the code either doesn't compile or produces unexpected results. On top of that, it is font-related, e.g., some things work with regular fonts, but fail with some other fonts, such as most of fonts here: https://tug.org/FontCatalogue/otherfonts.html#initials
Any insight into this issue and advice on how one could fix this would be highly appreciated!
Here is a typical example:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
%renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommand*first[1]substring#111 %%% stringstrings version
%newcommand*first[1]substr#111 %%% coolstr version DOES NOT WORK AT ALL
%newcommand*first[1]StrLeft#11 %%% xstring version DOES NOT WORK AT ALL
begindocument
lettrinefirstWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
lettrinefirstWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
lettrine stringstrings
New contributor
add a comment
|
I am encountering some weird behavior and errors when manipulating strings inside of lettrine arguments: the code either doesn't compile or produces unexpected results. On top of that, it is font-related, e.g., some things work with regular fonts, but fail with some other fonts, such as most of fonts here: https://tug.org/FontCatalogue/otherfonts.html#initials
Any insight into this issue and advice on how one could fix this would be highly appreciated!
Here is a typical example:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
%renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommand*first[1]substring#111 %%% stringstrings version
%newcommand*first[1]substr#111 %%% coolstr version DOES NOT WORK AT ALL
%newcommand*first[1]StrLeft#11 %%% xstring version DOES NOT WORK AT ALL
begindocument
lettrinefirstWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
lettrinefirstWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
lettrine stringstrings
New contributor
1
I understand your goals and they are noble. However, when I wanted to uselettrine
(and had no time), I just definednewcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You uselettrine
once per chapter, it's not that much work.
– Oleg Lobachev
10 hours ago
1
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago
add a comment
|
I am encountering some weird behavior and errors when manipulating strings inside of lettrine arguments: the code either doesn't compile or produces unexpected results. On top of that, it is font-related, e.g., some things work with regular fonts, but fail with some other fonts, such as most of fonts here: https://tug.org/FontCatalogue/otherfonts.html#initials
Any insight into this issue and advice on how one could fix this would be highly appreciated!
Here is a typical example:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
%renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommand*first[1]substring#111 %%% stringstrings version
%newcommand*first[1]substr#111 %%% coolstr version DOES NOT WORK AT ALL
%newcommand*first[1]StrLeft#11 %%% xstring version DOES NOT WORK AT ALL
begindocument
lettrinefirstWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
lettrinefirstWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
lettrine stringstrings
New contributor
I am encountering some weird behavior and errors when manipulating strings inside of lettrine arguments: the code either doesn't compile or produces unexpected results. On top of that, it is font-related, e.g., some things work with regular fonts, but fail with some other fonts, such as most of fonts here: https://tug.org/FontCatalogue/otherfonts.html#initials
Any insight into this issue and advice on how one could fix this would be highly appreciated!
Here is a typical example:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
%renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommand*first[1]substring#111 %%% stringstrings version
%newcommand*first[1]substr#111 %%% coolstr version DOES NOT WORK AT ALL
%newcommand*first[1]StrLeft#11 %%% xstring version DOES NOT WORK AT ALL
begindocument
lettrinefirstWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
lettrinefirstWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
lettrine stringstrings
lettrine stringstrings
New contributor
New contributor
New contributor
asked 11 hours ago
Iiro UllinIiro Ullin
233 bronze badges
233 bronze badges
New contributor
New contributor
1
I understand your goals and they are noble. However, when I wanted to uselettrine
(and had no time), I just definednewcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You uselettrine
once per chapter, it's not that much work.
– Oleg Lobachev
10 hours ago
1
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago
add a comment
|
1
I understand your goals and they are noble. However, when I wanted to uselettrine
(and had no time), I just definednewcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You uselettrine
once per chapter, it's not that much work.
– Oleg Lobachev
10 hours ago
1
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago
1
1
I understand your goals and they are noble. However, when I wanted to use
lettrine
(and had no time), I just defined newcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You use lettrine
once per chapter, it's not that much work.– Oleg Lobachev
10 hours ago
I understand your goals and they are noble. However, when I wanted to use
lettrine
(and had no time), I just defined newcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You use lettrine
once per chapter, it's not that much work.– Oleg Lobachev
10 hours ago
1
1
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago
add a comment
|
2 Answers
2
active
oldest
votes
I recommend, in a case like this, doing it with raw TeX, without parsing packages.
documentclassarticle
usepackagetimes,lettrine,Eileen
deffirstaux#1#2relax#1#2
newcommandflettrine[1]expandafterlettrinefirstaux#1relax
begindocument
flettrineWhat the duck?bigskip
renewcommand*LettrineFontHookEileenfamily
flettrineWhat the duck?
enddocument
If you wanted to use stringstrings
for other reasons (more complex manipulations, for example), I would use substring
to store the result in thestring
, and then pass thestring
on to lettrine
, in this fashion:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
newcommand*first[1]substring[q]#111 %%% stringstrings version
newcommandflettrine[2]first#1lettrinethestring#2
begindocument
flettrineWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
flettrineWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
add a comment
|
With expl3
it's really easy:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xparse
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
ExplSyntaxOn
NewDocumentCommandIiroLettrineOm
lettrine[#1]tl_range:nnn #2 1 1 tl_range:nnn #2 2 -1
ExplSyntaxOff
begindocument
IiroLettrineWhat the duck?
enddocument
The problem with your code is that StrLeft#11
doesn't produce the first letter, but the set of instructions for printing it, but lettrine
wants just a letter (after expansion).
The tl_range:nnn
function is fully expandable, so it makes no problem to lettrine
. With tl_range:nnn #1 1 1
the first item in the argument is delivered; with tl_range:nnn #1 2 -1
the remaining items are produced (the negative second number means “up to the last item”).
Since small caps are needed, it's better to use newtxtext
that provides real small caps, instead of the faked ones you get with times
.
You can do it also with xstring
, using its trailing optional argument feature:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xstring
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommandIiroLettrine[2][]%
StrLeft#21[firstletter]%
StrGobbleLeft#21[otherletters]%
lettrine[#1]firstletterotherletters%
begindocument
IiroLettrineWhat the duck?
enddocument
In both cases I kept the optional argument to lettrine
available in IiroLettrine
.
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f509105%2flettrine-string-manipulation-some-fonts-errors-and-weird-issues%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I recommend, in a case like this, doing it with raw TeX, without parsing packages.
documentclassarticle
usepackagetimes,lettrine,Eileen
deffirstaux#1#2relax#1#2
newcommandflettrine[1]expandafterlettrinefirstaux#1relax
begindocument
flettrineWhat the duck?bigskip
renewcommand*LettrineFontHookEileenfamily
flettrineWhat the duck?
enddocument
If you wanted to use stringstrings
for other reasons (more complex manipulations, for example), I would use substring
to store the result in thestring
, and then pass thestring
on to lettrine
, in this fashion:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
newcommand*first[1]substring[q]#111 %%% stringstrings version
newcommandflettrine[2]first#1lettrinethestring#2
begindocument
flettrineWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
flettrineWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
add a comment
|
I recommend, in a case like this, doing it with raw TeX, without parsing packages.
documentclassarticle
usepackagetimes,lettrine,Eileen
deffirstaux#1#2relax#1#2
newcommandflettrine[1]expandafterlettrinefirstaux#1relax
begindocument
flettrineWhat the duck?bigskip
renewcommand*LettrineFontHookEileenfamily
flettrineWhat the duck?
enddocument
If you wanted to use stringstrings
for other reasons (more complex manipulations, for example), I would use substring
to store the result in thestring
, and then pass thestring
on to lettrine
, in this fashion:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
newcommand*first[1]substring[q]#111 %%% stringstrings version
newcommandflettrine[2]first#1lettrinethestring#2
begindocument
flettrineWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
flettrineWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
add a comment
|
I recommend, in a case like this, doing it with raw TeX, without parsing packages.
documentclassarticle
usepackagetimes,lettrine,Eileen
deffirstaux#1#2relax#1#2
newcommandflettrine[1]expandafterlettrinefirstaux#1relax
begindocument
flettrineWhat the duck?bigskip
renewcommand*LettrineFontHookEileenfamily
flettrineWhat the duck?
enddocument
If you wanted to use stringstrings
for other reasons (more complex manipulations, for example), I would use substring
to store the result in thestring
, and then pass thestring
on to lettrine
, in this fashion:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
newcommand*first[1]substring[q]#111 %%% stringstrings version
newcommandflettrine[2]first#1lettrinethestring#2
begindocument
flettrineWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
flettrineWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
I recommend, in a case like this, doing it with raw TeX, without parsing packages.
documentclassarticle
usepackagetimes,lettrine,Eileen
deffirstaux#1#2relax#1#2
newcommandflettrine[1]expandafterlettrinefirstaux#1relax
begindocument
flettrineWhat the duck?bigskip
renewcommand*LettrineFontHookEileenfamily
flettrineWhat the duck?
enddocument
If you wanted to use stringstrings
for other reasons (more complex manipulations, for example), I would use substring
to store the result in thestring
, and then pass thestring
on to lettrine
, in this fashion:
documentclassarticle
usepackagetimes,lettrine,Eileen,coolstr,stringstrings,xstring
newcommand*first[1]substring[q]#111 %%% stringstrings version
newcommandflettrine[2]first#1lettrinethestring#2
begindocument
flettrineWhaaathat the duck? %%% DOES NOT WORK AS INTENDED WITH EILEEN
vspace3em
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
flettrineWhathat the duck? %%% DOES NOT WORK AT ALL WITH EILEEN
enddocument
edited 10 hours ago
answered 11 hours ago
Steven B. SegletesSteven B. Segletes
170k9 gold badges216 silver badges443 bronze badges
170k9 gold badges216 silver badges443 bronze badges
add a comment
|
add a comment
|
With expl3
it's really easy:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xparse
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
ExplSyntaxOn
NewDocumentCommandIiroLettrineOm
lettrine[#1]tl_range:nnn #2 1 1 tl_range:nnn #2 2 -1
ExplSyntaxOff
begindocument
IiroLettrineWhat the duck?
enddocument
The problem with your code is that StrLeft#11
doesn't produce the first letter, but the set of instructions for printing it, but lettrine
wants just a letter (after expansion).
The tl_range:nnn
function is fully expandable, so it makes no problem to lettrine
. With tl_range:nnn #1 1 1
the first item in the argument is delivered; with tl_range:nnn #1 2 -1
the remaining items are produced (the negative second number means “up to the last item”).
Since small caps are needed, it's better to use newtxtext
that provides real small caps, instead of the faked ones you get with times
.
You can do it also with xstring
, using its trailing optional argument feature:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xstring
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommandIiroLettrine[2][]%
StrLeft#21[firstletter]%
StrGobbleLeft#21[otherletters]%
lettrine[#1]firstletterotherletters%
begindocument
IiroLettrineWhat the duck?
enddocument
In both cases I kept the optional argument to lettrine
available in IiroLettrine
.
add a comment
|
With expl3
it's really easy:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xparse
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
ExplSyntaxOn
NewDocumentCommandIiroLettrineOm
lettrine[#1]tl_range:nnn #2 1 1 tl_range:nnn #2 2 -1
ExplSyntaxOff
begindocument
IiroLettrineWhat the duck?
enddocument
The problem with your code is that StrLeft#11
doesn't produce the first letter, but the set of instructions for printing it, but lettrine
wants just a letter (after expansion).
The tl_range:nnn
function is fully expandable, so it makes no problem to lettrine
. With tl_range:nnn #1 1 1
the first item in the argument is delivered; with tl_range:nnn #1 2 -1
the remaining items are produced (the negative second number means “up to the last item”).
Since small caps are needed, it's better to use newtxtext
that provides real small caps, instead of the faked ones you get with times
.
You can do it also with xstring
, using its trailing optional argument feature:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xstring
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommandIiroLettrine[2][]%
StrLeft#21[firstletter]%
StrGobbleLeft#21[otherletters]%
lettrine[#1]firstletterotherletters%
begindocument
IiroLettrineWhat the duck?
enddocument
In both cases I kept the optional argument to lettrine
available in IiroLettrine
.
add a comment
|
With expl3
it's really easy:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xparse
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
ExplSyntaxOn
NewDocumentCommandIiroLettrineOm
lettrine[#1]tl_range:nnn #2 1 1 tl_range:nnn #2 2 -1
ExplSyntaxOff
begindocument
IiroLettrineWhat the duck?
enddocument
The problem with your code is that StrLeft#11
doesn't produce the first letter, but the set of instructions for printing it, but lettrine
wants just a letter (after expansion).
The tl_range:nnn
function is fully expandable, so it makes no problem to lettrine
. With tl_range:nnn #1 1 1
the first item in the argument is delivered; with tl_range:nnn #1 2 -1
the remaining items are produced (the negative second number means “up to the last item”).
Since small caps are needed, it's better to use newtxtext
that provides real small caps, instead of the faked ones you get with times
.
You can do it also with xstring
, using its trailing optional argument feature:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xstring
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommandIiroLettrine[2][]%
StrLeft#21[firstletter]%
StrGobbleLeft#21[otherletters]%
lettrine[#1]firstletterotherletters%
begindocument
IiroLettrineWhat the duck?
enddocument
In both cases I kept the optional argument to lettrine
available in IiroLettrine
.
With expl3
it's really easy:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xparse
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
ExplSyntaxOn
NewDocumentCommandIiroLettrineOm
lettrine[#1]tl_range:nnn #2 1 1 tl_range:nnn #2 2 -1
ExplSyntaxOff
begindocument
IiroLettrineWhat the duck?
enddocument
The problem with your code is that StrLeft#11
doesn't produce the first letter, but the set of instructions for printing it, but lettrine
wants just a letter (after expansion).
The tl_range:nnn
function is fully expandable, so it makes no problem to lettrine
. With tl_range:nnn #1 1 1
the first item in the argument is delivered; with tl_range:nnn #1 2 -1
the remaining items are produced (the negative second number means “up to the last item”).
Since small caps are needed, it's better to use newtxtext
that provides real small caps, instead of the faked ones you get with times
.
You can do it also with xstring
, using its trailing optional argument feature:
documentclassarticle
usepackagenewtxtext,lettrine,Eileen,xstring
renewcommand*LettrineFontHookEileenfamily %%% Eileen fancy drop letter WTF?
newcommandIiroLettrine[2][]%
StrLeft#21[firstletter]%
StrGobbleLeft#21[otherletters]%
lettrine[#1]firstletterotherletters%
begindocument
IiroLettrineWhat the duck?
enddocument
In both cases I kept the optional argument to lettrine
available in IiroLettrine
.
answered 6 hours ago
egregegreg
770k91 gold badges2011 silver badges3367 bronze badges
770k91 gold badges2011 silver badges3367 bronze badges
add a comment
|
add a comment
|
Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.
Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.
Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.
Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f509105%2flettrine-string-manipulation-some-fonts-errors-and-weird-issues%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I understand your goals and they are noble. However, when I wanted to use
lettrine
(and had no time), I just definednewcommandflx[2]lettrine[lines=4,realheight=true]#1textsc#2
and did the separation in first letter and remaning part myself. You uselettrine
once per chapter, it's not that much work.– Oleg Lobachev
10 hours ago
1
Oleg: thanks for responding, however, this would not work for me, as the presented piece of code is just for illustration purposes. My actual code does the parsing automatically and has to extract first letters from words on its own. I've accepted Steven B. Segletes' answer, as not only it fixes the problem, but also teaches some TeX programming :) Thank you, Steven!
– Iiro Ullin
10 hours ago