Macro expansion inside href

Which RAF squadrons and aircraft types took part in the bombing of Berlin on the 25th of August 1940?

How do you funnel food off a cutting board?

How do I prevent a homebrew Grappling Hook feature from trivializing Tomb of Annihilation?

Do authors have to be politically correct in article-writing?

Calculate the true diameter of stars from photographic plate

What is a good reason for every spaceship to carry a weapon on board?

A Missing Symbol for This Logo

What is the wife of a henpecked husband called?

In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?

Does diversity provide anything that meritocracy does not?

What will happen if Parliament votes "no" on each of the Brexit-related votes to be held on the 12th, 13th and 14th of March?

Non-Cancer terminal illness that can affect young (age 10-13) girls?

False written accusations not made public - is there law to cover this?

How to not let the Identify spell spoil everything?

What language shall they sing in?

Early credit roll before the end of the film

Saint abbreviation

Why does magnet wire need to be insulated?

How would an AI self awareness kill switch work?

What is the difference between "...", '...', $'...', and $"..." quotes?

How can I play a serial killer in a party of good PCs?

Count repetitions of an array

What is the difference between rolling more dice versus fewer dice?

System.FinalException: SObject row does not allow errors



Macro expansion inside href














0















I want to make a shortcut for



href{tel:0123456789}{01,23,45,67,89}


I can use StrSubstitute from the xstring package as



StrSubstitute{01 23 45 67 89}{ }{,}


inside the second argument to href. But the same thing with



StrSubstitute{01 23 45 67 89}{ }{}


in the first argument won't work.



I think, I understand that this is an issue with macro expansion order. But how can I get LaTeX to first expand StrSubstitute into a string that can be parsed by href?



Here is a minimal example of what I actually want to achieve:



documentclass{minimal}

usepackage{xstring}
usepackage{hyperref}

newcommandphone[1]{href{tel:StrSubstitute{#1}{ }{}}{StrSubstitute{#1}{ }{,}}}

begin{document}

href{tel:0123456789}{01,23,45,67,89}

href{StrSubstitute{01 23 45 67 89}{ }{}}{StrSubstitute{01 23 45 67 89}{ }{,}}

phone{01 23 45 67 89}

end{document}








share



























    0















    I want to make a shortcut for



    href{tel:0123456789}{01,23,45,67,89}


    I can use StrSubstitute from the xstring package as



    StrSubstitute{01 23 45 67 89}{ }{,}


    inside the second argument to href. But the same thing with



    StrSubstitute{01 23 45 67 89}{ }{}


    in the first argument won't work.



    I think, I understand that this is an issue with macro expansion order. But how can I get LaTeX to first expand StrSubstitute into a string that can be parsed by href?



    Here is a minimal example of what I actually want to achieve:



    documentclass{minimal}

    usepackage{xstring}
    usepackage{hyperref}

    newcommandphone[1]{href{tel:StrSubstitute{#1}{ }{}}{StrSubstitute{#1}{ }{,}}}

    begin{document}

    href{tel:0123456789}{01,23,45,67,89}

    href{StrSubstitute{01 23 45 67 89}{ }{}}{StrSubstitute{01 23 45 67 89}{ }{,}}

    phone{01 23 45 67 89}

    end{document}








    share

























      0












      0








      0








      I want to make a shortcut for



      href{tel:0123456789}{01,23,45,67,89}


      I can use StrSubstitute from the xstring package as



      StrSubstitute{01 23 45 67 89}{ }{,}


      inside the second argument to href. But the same thing with



      StrSubstitute{01 23 45 67 89}{ }{}


      in the first argument won't work.



      I think, I understand that this is an issue with macro expansion order. But how can I get LaTeX to first expand StrSubstitute into a string that can be parsed by href?



      Here is a minimal example of what I actually want to achieve:



      documentclass{minimal}

      usepackage{xstring}
      usepackage{hyperref}

      newcommandphone[1]{href{tel:StrSubstitute{#1}{ }{}}{StrSubstitute{#1}{ }{,}}}

      begin{document}

      href{tel:0123456789}{01,23,45,67,89}

      href{StrSubstitute{01 23 45 67 89}{ }{}}{StrSubstitute{01 23 45 67 89}{ }{,}}

      phone{01 23 45 67 89}

      end{document}








      share














      I want to make a shortcut for



      href{tel:0123456789}{01,23,45,67,89}


      I can use StrSubstitute from the xstring package as



      StrSubstitute{01 23 45 67 89}{ }{,}


      inside the second argument to href. But the same thing with



      StrSubstitute{01 23 45 67 89}{ }{}


      in the first argument won't work.



      I think, I understand that this is an issue with macro expansion order. But how can I get LaTeX to first expand StrSubstitute into a string that can be parsed by href?



      Here is a minimal example of what I actually want to achieve:



      documentclass{minimal}

      usepackage{xstring}
      usepackage{hyperref}

      newcommandphone[1]{href{tel:StrSubstitute{#1}{ }{}}{StrSubstitute{#1}{ }{,}}}

      begin{document}

      href{tel:0123456789}{01,23,45,67,89}

      href{StrSubstitute{01 23 45 67 89}{ }{}}{StrSubstitute{01 23 45 67 89}{ }{,}}

      phone{01 23 45 67 89}

      end{document}






      hyperref xstring href





      share












      share










      share



      share










      asked 1 min ago









      DLichtiDLichti

      455




      455






















          0






          active

          oldest

          votes











          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/3.0/"u003ecc by-sa 3.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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476835%2fmacro-expansion-inside-href%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          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%2f476835%2fmacro-expansion-inside-href%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

          IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

          Cicindela nigrior Przypisy | Menu nawigacyjneCicindela varians unicolorManual for the Identification of the...

          Glossaries-extra: Adding glossaries package to “Clas­sicTh­e­sis” template by Dr. André Miede v. 4.6 ...