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;








4















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









share|improve this question







New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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






  • 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

















4















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









share|improve this question







New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 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






  • 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













4












4








4








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









share|improve this question







New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question







New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 11 hours ago









Iiro UllinIiro Ullin

233 bronze badges




233 bronze badges




New contributor



Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Iiro Ullin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • 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






  • 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





    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





    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










2 Answers
2






active

oldest

votes


















3
















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


enter image description here



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





share|improve this answer


































    2
















    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”).



    enter image description here



    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.






    share|improve this answer



























      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.









      draft saved

      draft discarded
















      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









      3
















      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


      enter image description here



      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





      share|improve this answer































        3
















        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


        enter image description here



        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





        share|improve this answer





























          3














          3










          3









          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


          enter image description here



          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





          share|improve this answer















          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


          enter image description here



          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






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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


























              2
















              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”).



              enter image description here



              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.






              share|improve this answer





























                2
















                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”).



                enter image description here



                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.






                share|improve this answer



























                  2














                  2










                  2









                  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”).



                  enter image description here



                  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.






                  share|improve this answer













                  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”).



                  enter image description here



                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 6 hours ago









                  egregegreg

                  770k91 gold badges2011 silver badges3367 bronze badges




                  770k91 gold badges2011 silver badges3367 bronze badges
























                      Iiro Ullin is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded

















                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單