Change the color of a single dot in `ddot` symbol












10















How can we change any of the two dots of the ddots math symbol?



I can change both of them:



documentclass{article}

usepackage{xcolor}

begin{document}

$color{red}ddot{color{black}x}$

end{document}


Two colored dots



Something like:



Example 1



Example 2










share|improve this question



























    10















    How can we change any of the two dots of the ddots math symbol?



    I can change both of them:



    documentclass{article}

    usepackage{xcolor}

    begin{document}

    $color{red}ddot{color{black}x}$

    end{document}


    Two colored dots



    Something like:



    Example 1



    Example 2










    share|improve this question

























      10












      10








      10








      How can we change any of the two dots of the ddots math symbol?



      I can change both of them:



      documentclass{article}

      usepackage{xcolor}

      begin{document}

      $color{red}ddot{color{black}x}$

      end{document}


      Two colored dots



      Something like:



      Example 1



      Example 2










      share|improve this question














      How can we change any of the two dots of the ddots math symbol?



      I can change both of them:



      documentclass{article}

      usepackage{xcolor}

      begin{document}

      $color{red}ddot{color{black}x}$

      end{document}


      Two colored dots



      Something like:



      Example 1



      Example 2







      math-mode formatting color






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      manoooohmanooooh

      1,1491517




      1,1491517






















          3 Answers
          3






          active

          oldest

          votes


















          13














          The following uses two slightly shifted coloured dot macros. The placement is not perfect and might be really bad for some letters.



          documentclass{article}

          % for colours
          usepackage{xcolor}
          % for mighty interface to define new macros, it also loads the l3 kernel
          usepackage{xparse}
          % for mathrlap
          usepackage{mathtools}

          % change to the coding language of LaTeX3 (in which spaces are ignored, that why
          % I can do stuff like { #2 } etc., also _ is a character now and can be part of
          % macro names)
          ExplSyntaxOn
          % define a user facing macro, it takes one optional argument, which by default
          % is empty and a mandatory one (neither of them can contain a par). The
          % optional argument will be split at a "," once.
          NewDocumentCommand cddot { >{SplitArgument{1}{,}}O{} m }
          {
          % pass on the now split argument #1 and the mandatory argument #2. #1 will
          % be something like { #1.1 } { #1.2 }
          __manooooh_cddot:nnn #1 { #2 }
          }
          % define a new internal macro (cs_new_protected:Npn is like protecteddef)
          cs_new_protected:Npn __manooooh_cddot:nnn #1 #2 #3
          {
          % start a new group
          group_begin:
          % check whether the first argument is blank (meaning it only contains spaces
          % or nothing), if it isn't blank change the color. It will be blank if you
          % don't use an optional argument or if you start your optional argument with
          % a ","
          tl_if_blank:nF { #1 } { color { #1 } }
          % mathrlap will print its argument without really taking any space, phantom
          % will only take the space of #3, mkern-1.5mu will move the dot slightly to
          % the left
          mathrlap { mkern-1.25mu dot { phantom { #3 } } }
          % end the group containing the first color
          group_end:
          % start a new group
          group_begin:
          % IfValueT will check whether the second part of the split argument was
          % available (so will result in True if there was a comma in [#1]). If there
          % was a second argument assume it is the second color
          IfValueT { #2 } { color { #2 } }
          % again mathrlap and a phantom #3, this time shifting the dot slightly to
          % the right by 2mu
          mathrlap { mkern+2.25mu dot { phantom { #3 } } }
          % end the second color's group
          group_end:
          % print #3 without further ado (since we used mathrlap previously we're
          % still on the same spot and due to the phantom #3 will only be printed
          % visible once
          #3
          }
          % end the LaTeX3 programming syntax
          ExplSyntaxOff

          begin{document}
          % without optional argument
          $cddot{x}$

          % with the first half of the optional argument
          $cddot[blue]{x}$

          % with the second half of the optional argument
          $cddot[,green]{x}$

          % with both halves of the optional argument
          $cddot[blue,green]{x}$

          % for comparison
          $ddot{x}$
          end{document}


          enter image description here






          share|improve this answer


























          • I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

            – manooooh
            yesterday








          • 2





            @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

            – Skillmon
            yesterday








          • 2





            It would be fantastic.

            – manooooh
            yesterday






          • 2





            @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

            – Skillmon
            yesterday






          • 1





            @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

            – Skillmon
            yesterday



















          11














          Adapting from the definition of dddot in amsmath. The bottom line in the picture shows the symbol superimposed on each other; the difference is really negligible.



          documentclass{article}
          usepackage{amsmath}
          usepackage{xcolor}

          makeatletter
          DeclareRobustCommand{colorddot}[3]{%
          % #1=color of first dot, #2=color of second dot, #3=accentee
          {mathop{kernz@#3}limits^{%
          vbox to-1.55ex@{%
          kern-tw@ex@
          hbox{normalfontkern0.05emtextcolor{#1}{.}kern-0.085emtextcolor{#2}{.}}
          vss
          }%
          }}%
          }
          makeatother

          begin{document}

          $ddot{x}$

          $colorddot{green}{blue}{x}$

          $ddot{x}$llap{$colorddot{green}{blue}{x}$}
          $colorddot{green}{blue}{x}$llap{$ddot{x}$}

          end{document}


          Beware that the different colors will make the dots to appear misaligned.



          enter image description here






          share|improve this answer





















          • 2





            Why is the kern slightly different between the cases? It is more than just an appearance.

            – Steven B. Segletes
            yesterday








          • 2





            @StevenB.Segletes Refined. :-)

            – egreg
            yesterday






          • 1





            Did you just post a non-expl3 answer while I did?

            – Skillmon
            yesterday






          • 1





            @Skillmon Let's share the task of promoting expl3. ;-)

            – egreg
            yesterday






          • 1





            @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

            – Skillmon
            yesterday



















          9














          One may just use the accents package, which was made for this.



          documentclass{article}
          usepackage{amsmath}
          usepackage{accents}
          usepackage{pgffor}
          usepackage{xcolor}
          newcommand{ColorDots}[2]{accentset{foreach X in {#1}
          {textcolor{X}{boldsymbol{.}}}}{#2}}
          begin{document}
          $accentset{boldsymbol{..}}{x}$ $ColorDots{red,blue}{y}$ $ColorDots{red}{z}$
          $ColorDots{red,orange,blue}{X}$
          end{document}


          enter image description here






          share|improve this answer
























          • Using a package which was made for it seems wrong :)

            – Skillmon
            5 hours ago











          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%2f480644%2fchange-the-color-of-a-single-dot-in-ddot-symbol%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          13














          The following uses two slightly shifted coloured dot macros. The placement is not perfect and might be really bad for some letters.



          documentclass{article}

          % for colours
          usepackage{xcolor}
          % for mighty interface to define new macros, it also loads the l3 kernel
          usepackage{xparse}
          % for mathrlap
          usepackage{mathtools}

          % change to the coding language of LaTeX3 (in which spaces are ignored, that why
          % I can do stuff like { #2 } etc., also _ is a character now and can be part of
          % macro names)
          ExplSyntaxOn
          % define a user facing macro, it takes one optional argument, which by default
          % is empty and a mandatory one (neither of them can contain a par). The
          % optional argument will be split at a "," once.
          NewDocumentCommand cddot { >{SplitArgument{1}{,}}O{} m }
          {
          % pass on the now split argument #1 and the mandatory argument #2. #1 will
          % be something like { #1.1 } { #1.2 }
          __manooooh_cddot:nnn #1 { #2 }
          }
          % define a new internal macro (cs_new_protected:Npn is like protecteddef)
          cs_new_protected:Npn __manooooh_cddot:nnn #1 #2 #3
          {
          % start a new group
          group_begin:
          % check whether the first argument is blank (meaning it only contains spaces
          % or nothing), if it isn't blank change the color. It will be blank if you
          % don't use an optional argument or if you start your optional argument with
          % a ","
          tl_if_blank:nF { #1 } { color { #1 } }
          % mathrlap will print its argument without really taking any space, phantom
          % will only take the space of #3, mkern-1.5mu will move the dot slightly to
          % the left
          mathrlap { mkern-1.25mu dot { phantom { #3 } } }
          % end the group containing the first color
          group_end:
          % start a new group
          group_begin:
          % IfValueT will check whether the second part of the split argument was
          % available (so will result in True if there was a comma in [#1]). If there
          % was a second argument assume it is the second color
          IfValueT { #2 } { color { #2 } }
          % again mathrlap and a phantom #3, this time shifting the dot slightly to
          % the right by 2mu
          mathrlap { mkern+2.25mu dot { phantom { #3 } } }
          % end the second color's group
          group_end:
          % print #3 without further ado (since we used mathrlap previously we're
          % still on the same spot and due to the phantom #3 will only be printed
          % visible once
          #3
          }
          % end the LaTeX3 programming syntax
          ExplSyntaxOff

          begin{document}
          % without optional argument
          $cddot{x}$

          % with the first half of the optional argument
          $cddot[blue]{x}$

          % with the second half of the optional argument
          $cddot[,green]{x}$

          % with both halves of the optional argument
          $cddot[blue,green]{x}$

          % for comparison
          $ddot{x}$
          end{document}


          enter image description here






          share|improve this answer


























          • I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

            – manooooh
            yesterday








          • 2





            @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

            – Skillmon
            yesterday








          • 2





            It would be fantastic.

            – manooooh
            yesterday






          • 2





            @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

            – Skillmon
            yesterday






          • 1





            @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

            – Skillmon
            yesterday
















          13














          The following uses two slightly shifted coloured dot macros. The placement is not perfect and might be really bad for some letters.



          documentclass{article}

          % for colours
          usepackage{xcolor}
          % for mighty interface to define new macros, it also loads the l3 kernel
          usepackage{xparse}
          % for mathrlap
          usepackage{mathtools}

          % change to the coding language of LaTeX3 (in which spaces are ignored, that why
          % I can do stuff like { #2 } etc., also _ is a character now and can be part of
          % macro names)
          ExplSyntaxOn
          % define a user facing macro, it takes one optional argument, which by default
          % is empty and a mandatory one (neither of them can contain a par). The
          % optional argument will be split at a "," once.
          NewDocumentCommand cddot { >{SplitArgument{1}{,}}O{} m }
          {
          % pass on the now split argument #1 and the mandatory argument #2. #1 will
          % be something like { #1.1 } { #1.2 }
          __manooooh_cddot:nnn #1 { #2 }
          }
          % define a new internal macro (cs_new_protected:Npn is like protecteddef)
          cs_new_protected:Npn __manooooh_cddot:nnn #1 #2 #3
          {
          % start a new group
          group_begin:
          % check whether the first argument is blank (meaning it only contains spaces
          % or nothing), if it isn't blank change the color. It will be blank if you
          % don't use an optional argument or if you start your optional argument with
          % a ","
          tl_if_blank:nF { #1 } { color { #1 } }
          % mathrlap will print its argument without really taking any space, phantom
          % will only take the space of #3, mkern-1.5mu will move the dot slightly to
          % the left
          mathrlap { mkern-1.25mu dot { phantom { #3 } } }
          % end the group containing the first color
          group_end:
          % start a new group
          group_begin:
          % IfValueT will check whether the second part of the split argument was
          % available (so will result in True if there was a comma in [#1]). If there
          % was a second argument assume it is the second color
          IfValueT { #2 } { color { #2 } }
          % again mathrlap and a phantom #3, this time shifting the dot slightly to
          % the right by 2mu
          mathrlap { mkern+2.25mu dot { phantom { #3 } } }
          % end the second color's group
          group_end:
          % print #3 without further ado (since we used mathrlap previously we're
          % still on the same spot and due to the phantom #3 will only be printed
          % visible once
          #3
          }
          % end the LaTeX3 programming syntax
          ExplSyntaxOff

          begin{document}
          % without optional argument
          $cddot{x}$

          % with the first half of the optional argument
          $cddot[blue]{x}$

          % with the second half of the optional argument
          $cddot[,green]{x}$

          % with both halves of the optional argument
          $cddot[blue,green]{x}$

          % for comparison
          $ddot{x}$
          end{document}


          enter image description here






          share|improve this answer


























          • I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

            – manooooh
            yesterday








          • 2





            @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

            – Skillmon
            yesterday








          • 2





            It would be fantastic.

            – manooooh
            yesterday






          • 2





            @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

            – Skillmon
            yesterday






          • 1





            @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

            – Skillmon
            yesterday














          13












          13








          13







          The following uses two slightly shifted coloured dot macros. The placement is not perfect and might be really bad for some letters.



          documentclass{article}

          % for colours
          usepackage{xcolor}
          % for mighty interface to define new macros, it also loads the l3 kernel
          usepackage{xparse}
          % for mathrlap
          usepackage{mathtools}

          % change to the coding language of LaTeX3 (in which spaces are ignored, that why
          % I can do stuff like { #2 } etc., also _ is a character now and can be part of
          % macro names)
          ExplSyntaxOn
          % define a user facing macro, it takes one optional argument, which by default
          % is empty and a mandatory one (neither of them can contain a par). The
          % optional argument will be split at a "," once.
          NewDocumentCommand cddot { >{SplitArgument{1}{,}}O{} m }
          {
          % pass on the now split argument #1 and the mandatory argument #2. #1 will
          % be something like { #1.1 } { #1.2 }
          __manooooh_cddot:nnn #1 { #2 }
          }
          % define a new internal macro (cs_new_protected:Npn is like protecteddef)
          cs_new_protected:Npn __manooooh_cddot:nnn #1 #2 #3
          {
          % start a new group
          group_begin:
          % check whether the first argument is blank (meaning it only contains spaces
          % or nothing), if it isn't blank change the color. It will be blank if you
          % don't use an optional argument or if you start your optional argument with
          % a ","
          tl_if_blank:nF { #1 } { color { #1 } }
          % mathrlap will print its argument without really taking any space, phantom
          % will only take the space of #3, mkern-1.5mu will move the dot slightly to
          % the left
          mathrlap { mkern-1.25mu dot { phantom { #3 } } }
          % end the group containing the first color
          group_end:
          % start a new group
          group_begin:
          % IfValueT will check whether the second part of the split argument was
          % available (so will result in True if there was a comma in [#1]). If there
          % was a second argument assume it is the second color
          IfValueT { #2 } { color { #2 } }
          % again mathrlap and a phantom #3, this time shifting the dot slightly to
          % the right by 2mu
          mathrlap { mkern+2.25mu dot { phantom { #3 } } }
          % end the second color's group
          group_end:
          % print #3 without further ado (since we used mathrlap previously we're
          % still on the same spot and due to the phantom #3 will only be printed
          % visible once
          #3
          }
          % end the LaTeX3 programming syntax
          ExplSyntaxOff

          begin{document}
          % without optional argument
          $cddot{x}$

          % with the first half of the optional argument
          $cddot[blue]{x}$

          % with the second half of the optional argument
          $cddot[,green]{x}$

          % with both halves of the optional argument
          $cddot[blue,green]{x}$

          % for comparison
          $ddot{x}$
          end{document}


          enter image description here






          share|improve this answer















          The following uses two slightly shifted coloured dot macros. The placement is not perfect and might be really bad for some letters.



          documentclass{article}

          % for colours
          usepackage{xcolor}
          % for mighty interface to define new macros, it also loads the l3 kernel
          usepackage{xparse}
          % for mathrlap
          usepackage{mathtools}

          % change to the coding language of LaTeX3 (in which spaces are ignored, that why
          % I can do stuff like { #2 } etc., also _ is a character now and can be part of
          % macro names)
          ExplSyntaxOn
          % define a user facing macro, it takes one optional argument, which by default
          % is empty and a mandatory one (neither of them can contain a par). The
          % optional argument will be split at a "," once.
          NewDocumentCommand cddot { >{SplitArgument{1}{,}}O{} m }
          {
          % pass on the now split argument #1 and the mandatory argument #2. #1 will
          % be something like { #1.1 } { #1.2 }
          __manooooh_cddot:nnn #1 { #2 }
          }
          % define a new internal macro (cs_new_protected:Npn is like protecteddef)
          cs_new_protected:Npn __manooooh_cddot:nnn #1 #2 #3
          {
          % start a new group
          group_begin:
          % check whether the first argument is blank (meaning it only contains spaces
          % or nothing), if it isn't blank change the color. It will be blank if you
          % don't use an optional argument or if you start your optional argument with
          % a ","
          tl_if_blank:nF { #1 } { color { #1 } }
          % mathrlap will print its argument without really taking any space, phantom
          % will only take the space of #3, mkern-1.5mu will move the dot slightly to
          % the left
          mathrlap { mkern-1.25mu dot { phantom { #3 } } }
          % end the group containing the first color
          group_end:
          % start a new group
          group_begin:
          % IfValueT will check whether the second part of the split argument was
          % available (so will result in True if there was a comma in [#1]). If there
          % was a second argument assume it is the second color
          IfValueT { #2 } { color { #2 } }
          % again mathrlap and a phantom #3, this time shifting the dot slightly to
          % the right by 2mu
          mathrlap { mkern+2.25mu dot { phantom { #3 } } }
          % end the second color's group
          group_end:
          % print #3 without further ado (since we used mathrlap previously we're
          % still on the same spot and due to the phantom #3 will only be printed
          % visible once
          #3
          }
          % end the LaTeX3 programming syntax
          ExplSyntaxOff

          begin{document}
          % without optional argument
          $cddot{x}$

          % with the first half of the optional argument
          $cddot[blue]{x}$

          % with the second half of the optional argument
          $cddot[,green]{x}$

          % with both halves of the optional argument
          $cddot[blue,green]{x}$

          % for comparison
          $ddot{x}$
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          SkillmonSkillmon

          23.5k12247




          23.5k12247













          • I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

            – manooooh
            yesterday








          • 2





            @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

            – Skillmon
            yesterday








          • 2





            It would be fantastic.

            – manooooh
            yesterday






          • 2





            @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

            – Skillmon
            yesterday






          • 1





            @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

            – Skillmon
            yesterday



















          • I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

            – manooooh
            yesterday








          • 2





            @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

            – Skillmon
            yesterday








          • 2





            It would be fantastic.

            – manooooh
            yesterday






          • 2





            @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

            – Skillmon
            yesterday






          • 1





            @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

            – Skillmon
            yesterday

















          I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

          – manooooh
          yesterday







          I have never read about NewDocumentCommand. I compared the normal output with yours and they are indeed the same! Maybe adding more stuff will break the line spacing, but we need an example for that. Thanks for the answer!

          – manooooh
          yesterday






          2




          2





          @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

          – Skillmon
          yesterday







          @manooooh NewDocumentCommand is part of xparse which is a LaTeX3 package to define macros with powerful syntax. Also I use tl_if_blank:nF which is part of LaTeX3's l3tl which is part of the L3 kernel. Do you want me to add comments to the code to explain it a bit?

          – Skillmon
          yesterday






          2




          2





          It would be fantastic.

          – manooooh
          yesterday





          It would be fantastic.

          – manooooh
          yesterday




          2




          2





          @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

          – Skillmon
          yesterday





          @manooooh I've added loads of comments to the code, if you still have questions, feel free to ask.

          – Skillmon
          yesterday




          1




          1





          @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

          – Skillmon
          yesterday





          @manooooh the spaces are only a useful side effect (no unintentional spaces which is often an issue, especially for people not that experienced in writing their own macros), the main point being the _ and : in macro names, which is the internal convention of L3. Without ExplSyntaxOn I couldn't use macros like tl_if_blank:nF directly. The macro names in L3 are built from several parts, tl is the module it's taken from, _if_blank is the name/description, :nF means it takes two arguments, one a normal one, the second executed in the False branch.

          – Skillmon
          yesterday











          11














          Adapting from the definition of dddot in amsmath. The bottom line in the picture shows the symbol superimposed on each other; the difference is really negligible.



          documentclass{article}
          usepackage{amsmath}
          usepackage{xcolor}

          makeatletter
          DeclareRobustCommand{colorddot}[3]{%
          % #1=color of first dot, #2=color of second dot, #3=accentee
          {mathop{kernz@#3}limits^{%
          vbox to-1.55ex@{%
          kern-tw@ex@
          hbox{normalfontkern0.05emtextcolor{#1}{.}kern-0.085emtextcolor{#2}{.}}
          vss
          }%
          }}%
          }
          makeatother

          begin{document}

          $ddot{x}$

          $colorddot{green}{blue}{x}$

          $ddot{x}$llap{$colorddot{green}{blue}{x}$}
          $colorddot{green}{blue}{x}$llap{$ddot{x}$}

          end{document}


          Beware that the different colors will make the dots to appear misaligned.



          enter image description here






          share|improve this answer





















          • 2





            Why is the kern slightly different between the cases? It is more than just an appearance.

            – Steven B. Segletes
            yesterday








          • 2





            @StevenB.Segletes Refined. :-)

            – egreg
            yesterday






          • 1





            Did you just post a non-expl3 answer while I did?

            – Skillmon
            yesterday






          • 1





            @Skillmon Let's share the task of promoting expl3. ;-)

            – egreg
            yesterday






          • 1





            @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

            – Skillmon
            yesterday
















          11














          Adapting from the definition of dddot in amsmath. The bottom line in the picture shows the symbol superimposed on each other; the difference is really negligible.



          documentclass{article}
          usepackage{amsmath}
          usepackage{xcolor}

          makeatletter
          DeclareRobustCommand{colorddot}[3]{%
          % #1=color of first dot, #2=color of second dot, #3=accentee
          {mathop{kernz@#3}limits^{%
          vbox to-1.55ex@{%
          kern-tw@ex@
          hbox{normalfontkern0.05emtextcolor{#1}{.}kern-0.085emtextcolor{#2}{.}}
          vss
          }%
          }}%
          }
          makeatother

          begin{document}

          $ddot{x}$

          $colorddot{green}{blue}{x}$

          $ddot{x}$llap{$colorddot{green}{blue}{x}$}
          $colorddot{green}{blue}{x}$llap{$ddot{x}$}

          end{document}


          Beware that the different colors will make the dots to appear misaligned.



          enter image description here






          share|improve this answer





















          • 2





            Why is the kern slightly different between the cases? It is more than just an appearance.

            – Steven B. Segletes
            yesterday








          • 2





            @StevenB.Segletes Refined. :-)

            – egreg
            yesterday






          • 1





            Did you just post a non-expl3 answer while I did?

            – Skillmon
            yesterday






          • 1





            @Skillmon Let's share the task of promoting expl3. ;-)

            – egreg
            yesterday






          • 1





            @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

            – Skillmon
            yesterday














          11












          11








          11







          Adapting from the definition of dddot in amsmath. The bottom line in the picture shows the symbol superimposed on each other; the difference is really negligible.



          documentclass{article}
          usepackage{amsmath}
          usepackage{xcolor}

          makeatletter
          DeclareRobustCommand{colorddot}[3]{%
          % #1=color of first dot, #2=color of second dot, #3=accentee
          {mathop{kernz@#3}limits^{%
          vbox to-1.55ex@{%
          kern-tw@ex@
          hbox{normalfontkern0.05emtextcolor{#1}{.}kern-0.085emtextcolor{#2}{.}}
          vss
          }%
          }}%
          }
          makeatother

          begin{document}

          $ddot{x}$

          $colorddot{green}{blue}{x}$

          $ddot{x}$llap{$colorddot{green}{blue}{x}$}
          $colorddot{green}{blue}{x}$llap{$ddot{x}$}

          end{document}


          Beware that the different colors will make the dots to appear misaligned.



          enter image description here






          share|improve this answer















          Adapting from the definition of dddot in amsmath. The bottom line in the picture shows the symbol superimposed on each other; the difference is really negligible.



          documentclass{article}
          usepackage{amsmath}
          usepackage{xcolor}

          makeatletter
          DeclareRobustCommand{colorddot}[3]{%
          % #1=color of first dot, #2=color of second dot, #3=accentee
          {mathop{kernz@#3}limits^{%
          vbox to-1.55ex@{%
          kern-tw@ex@
          hbox{normalfontkern0.05emtextcolor{#1}{.}kern-0.085emtextcolor{#2}{.}}
          vss
          }%
          }}%
          }
          makeatother

          begin{document}

          $ddot{x}$

          $colorddot{green}{blue}{x}$

          $ddot{x}$llap{$colorddot{green}{blue}{x}$}
          $colorddot{green}{blue}{x}$llap{$ddot{x}$}

          end{document}


          Beware that the different colors will make the dots to appear misaligned.



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited yesterday

























          answered yesterday









          egregegreg

          728k8819243235




          728k8819243235








          • 2





            Why is the kern slightly different between the cases? It is more than just an appearance.

            – Steven B. Segletes
            yesterday








          • 2





            @StevenB.Segletes Refined. :-)

            – egreg
            yesterday






          • 1





            Did you just post a non-expl3 answer while I did?

            – Skillmon
            yesterday






          • 1





            @Skillmon Let's share the task of promoting expl3. ;-)

            – egreg
            yesterday






          • 1





            @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

            – Skillmon
            yesterday














          • 2





            Why is the kern slightly different between the cases? It is more than just an appearance.

            – Steven B. Segletes
            yesterday








          • 2





            @StevenB.Segletes Refined. :-)

            – egreg
            yesterday






          • 1





            Did you just post a non-expl3 answer while I did?

            – Skillmon
            yesterday






          • 1





            @Skillmon Let's share the task of promoting expl3. ;-)

            – egreg
            yesterday






          • 1





            @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

            – Skillmon
            yesterday








          2




          2





          Why is the kern slightly different between the cases? It is more than just an appearance.

          – Steven B. Segletes
          yesterday







          Why is the kern slightly different between the cases? It is more than just an appearance.

          – Steven B. Segletes
          yesterday






          2




          2





          @StevenB.Segletes Refined. :-)

          – egreg
          yesterday





          @StevenB.Segletes Refined. :-)

          – egreg
          yesterday




          1




          1





          Did you just post a non-expl3 answer while I did?

          – Skillmon
          yesterday





          Did you just post a non-expl3 answer while I did?

          – Skillmon
          yesterday




          1




          1





          @Skillmon Let's share the task of promoting expl3. ;-)

          – egreg
          yesterday





          @Skillmon Let's share the task of promoting expl3. ;-)

          – egreg
          yesterday




          1




          1





          @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

          – Skillmon
          yesterday





          @egreg well, mine is a wild mix of expl3 and LaTeX2e stuff, unfortunately...

          – Skillmon
          yesterday











          9














          One may just use the accents package, which was made for this.



          documentclass{article}
          usepackage{amsmath}
          usepackage{accents}
          usepackage{pgffor}
          usepackage{xcolor}
          newcommand{ColorDots}[2]{accentset{foreach X in {#1}
          {textcolor{X}{boldsymbol{.}}}}{#2}}
          begin{document}
          $accentset{boldsymbol{..}}{x}$ $ColorDots{red,blue}{y}$ $ColorDots{red}{z}$
          $ColorDots{red,orange,blue}{X}$
          end{document}


          enter image description here






          share|improve this answer
























          • Using a package which was made for it seems wrong :)

            – Skillmon
            5 hours ago
















          9














          One may just use the accents package, which was made for this.



          documentclass{article}
          usepackage{amsmath}
          usepackage{accents}
          usepackage{pgffor}
          usepackage{xcolor}
          newcommand{ColorDots}[2]{accentset{foreach X in {#1}
          {textcolor{X}{boldsymbol{.}}}}{#2}}
          begin{document}
          $accentset{boldsymbol{..}}{x}$ $ColorDots{red,blue}{y}$ $ColorDots{red}{z}$
          $ColorDots{red,orange,blue}{X}$
          end{document}


          enter image description here






          share|improve this answer
























          • Using a package which was made for it seems wrong :)

            – Skillmon
            5 hours ago














          9












          9








          9







          One may just use the accents package, which was made for this.



          documentclass{article}
          usepackage{amsmath}
          usepackage{accents}
          usepackage{pgffor}
          usepackage{xcolor}
          newcommand{ColorDots}[2]{accentset{foreach X in {#1}
          {textcolor{X}{boldsymbol{.}}}}{#2}}
          begin{document}
          $accentset{boldsymbol{..}}{x}$ $ColorDots{red,blue}{y}$ $ColorDots{red}{z}$
          $ColorDots{red,orange,blue}{X}$
          end{document}


          enter image description here






          share|improve this answer













          One may just use the accents package, which was made for this.



          documentclass{article}
          usepackage{amsmath}
          usepackage{accents}
          usepackage{pgffor}
          usepackage{xcolor}
          newcommand{ColorDots}[2]{accentset{foreach X in {#1}
          {textcolor{X}{boldsymbol{.}}}}{#2}}
          begin{document}
          $accentset{boldsymbol{..}}{x}$ $ColorDots{red,blue}{y}$ $ColorDots{red}{z}$
          $ColorDots{red,orange,blue}{X}$
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          marmotmarmot

          111k5138257




          111k5138257













          • Using a package which was made for it seems wrong :)

            – Skillmon
            5 hours ago



















          • Using a package which was made for it seems wrong :)

            – Skillmon
            5 hours ago

















          Using a package which was made for it seems wrong :)

          – Skillmon
          5 hours ago





          Using a package which was made for it seems wrong :)

          – Skillmon
          5 hours ago


















          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%2f480644%2fchange-the-color-of-a-single-dot-in-ddot-symbol%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

          數位音樂下載

          When can things happen in Etherscan, such as the picture below?

          格利澤436b