Font style in ref and autoref











up vote
0
down vote

favorite












I'd like to use both autoref and ref, so when enumerating references in the text I can get something like "Ecuaciones 1 y 2" (with Ecuación 1 being a link inserted by autoref and 2 a link inserted by ref). The problem is that I need all the references in the text to be sans serif, but I can't get autoref and ref to use sans serif by default, and inserting textsf or sffamily in every case wouldn't be practical. With this MWE:



documentclass[twoside, 11pt]{book}
usepackage[utf8]{inputenc}
usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
renewcommand{theequation}{sffamilythechapter.arabic{equation}}
renewcommand{thetable}{thechapter.arabic{figure}}
usepackage[font={sf, footnotesize}]{caption}
usepackage[colorlinks=true]{hyperref}

begin{document}

Este texto es sólo para incluir las referencias a la autoref{tab:prueba}, la autoref{eq:ecuacion1} y la ref{eq:ecuacion2}.

begin{table}
begin{center}
caption{Prueba de tabla.}
label{tab:prueba}
begin{tabular}{c c c}
Columna 1 & Columna 2 & Resultados\
1 & 1 & 2
end{tabular}
end{center}
end{table}

begin{equation}
label{eq:ecuacion1}
1 + 1 = 2
end{equation}

begin{equation}
label{eq:ecuacion2}
1 + 1 = 2
end{equation}

end{document}


I get this:
enter image description here



which shows a terrible mess of mismatched fonts: Tabla 0.0 is all serif, Ecuación is in serif, but 0.1 and 0.2 are sans serif.



I tried things like:



renewcommand{thetable}{sffamilythechapter.arabic{table}}


but doing so ruins the formatting of the captions.



Is there any way of getting all cross references in sans serif? Thanks.










share|improve this question







New contributor




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
























    up vote
    0
    down vote

    favorite












    I'd like to use both autoref and ref, so when enumerating references in the text I can get something like "Ecuaciones 1 y 2" (with Ecuación 1 being a link inserted by autoref and 2 a link inserted by ref). The problem is that I need all the references in the text to be sans serif, but I can't get autoref and ref to use sans serif by default, and inserting textsf or sffamily in every case wouldn't be practical. With this MWE:



    documentclass[twoside, 11pt]{book}
    usepackage[utf8]{inputenc}
    usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
    renewcommand{theequation}{sffamilythechapter.arabic{equation}}
    renewcommand{thetable}{thechapter.arabic{figure}}
    usepackage[font={sf, footnotesize}]{caption}
    usepackage[colorlinks=true]{hyperref}

    begin{document}

    Este texto es sólo para incluir las referencias a la autoref{tab:prueba}, la autoref{eq:ecuacion1} y la ref{eq:ecuacion2}.

    begin{table}
    begin{center}
    caption{Prueba de tabla.}
    label{tab:prueba}
    begin{tabular}{c c c}
    Columna 1 & Columna 2 & Resultados\
    1 & 1 & 2
    end{tabular}
    end{center}
    end{table}

    begin{equation}
    label{eq:ecuacion1}
    1 + 1 = 2
    end{equation}

    begin{equation}
    label{eq:ecuacion2}
    1 + 1 = 2
    end{equation}

    end{document}


    I get this:
    enter image description here



    which shows a terrible mess of mismatched fonts: Tabla 0.0 is all serif, Ecuación is in serif, but 0.1 and 0.2 are sans serif.



    I tried things like:



    renewcommand{thetable}{sffamilythechapter.arabic{table}}


    but doing so ruins the formatting of the captions.



    Is there any way of getting all cross references in sans serif? Thanks.










    share|improve this question







    New contributor




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






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'd like to use both autoref and ref, so when enumerating references in the text I can get something like "Ecuaciones 1 y 2" (with Ecuación 1 being a link inserted by autoref and 2 a link inserted by ref). The problem is that I need all the references in the text to be sans serif, but I can't get autoref and ref to use sans serif by default, and inserting textsf or sffamily in every case wouldn't be practical. With this MWE:



      documentclass[twoside, 11pt]{book}
      usepackage[utf8]{inputenc}
      usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
      renewcommand{theequation}{sffamilythechapter.arabic{equation}}
      renewcommand{thetable}{thechapter.arabic{figure}}
      usepackage[font={sf, footnotesize}]{caption}
      usepackage[colorlinks=true]{hyperref}

      begin{document}

      Este texto es sólo para incluir las referencias a la autoref{tab:prueba}, la autoref{eq:ecuacion1} y la ref{eq:ecuacion2}.

      begin{table}
      begin{center}
      caption{Prueba de tabla.}
      label{tab:prueba}
      begin{tabular}{c c c}
      Columna 1 & Columna 2 & Resultados\
      1 & 1 & 2
      end{tabular}
      end{center}
      end{table}

      begin{equation}
      label{eq:ecuacion1}
      1 + 1 = 2
      end{equation}

      begin{equation}
      label{eq:ecuacion2}
      1 + 1 = 2
      end{equation}

      end{document}


      I get this:
      enter image description here



      which shows a terrible mess of mismatched fonts: Tabla 0.0 is all serif, Ecuación is in serif, but 0.1 and 0.2 are sans serif.



      I tried things like:



      renewcommand{thetable}{sffamilythechapter.arabic{table}}


      but doing so ruins the formatting of the captions.



      Is there any way of getting all cross references in sans serif? Thanks.










      share|improve this question







      New contributor




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











      I'd like to use both autoref and ref, so when enumerating references in the text I can get something like "Ecuaciones 1 y 2" (with Ecuación 1 being a link inserted by autoref and 2 a link inserted by ref). The problem is that I need all the references in the text to be sans serif, but I can't get autoref and ref to use sans serif by default, and inserting textsf or sffamily in every case wouldn't be practical. With this MWE:



      documentclass[twoside, 11pt]{book}
      usepackage[utf8]{inputenc}
      usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
      renewcommand{theequation}{sffamilythechapter.arabic{equation}}
      renewcommand{thetable}{thechapter.arabic{figure}}
      usepackage[font={sf, footnotesize}]{caption}
      usepackage[colorlinks=true]{hyperref}

      begin{document}

      Este texto es sólo para incluir las referencias a la autoref{tab:prueba}, la autoref{eq:ecuacion1} y la ref{eq:ecuacion2}.

      begin{table}
      begin{center}
      caption{Prueba de tabla.}
      label{tab:prueba}
      begin{tabular}{c c c}
      Columna 1 & Columna 2 & Resultados\
      1 & 1 & 2
      end{tabular}
      end{center}
      end{table}

      begin{equation}
      label{eq:ecuacion1}
      1 + 1 = 2
      end{equation}

      begin{equation}
      label{eq:ecuacion2}
      1 + 1 = 2
      end{equation}

      end{document}


      I get this:
      enter image description here



      which shows a terrible mess of mismatched fonts: Tabla 0.0 is all serif, Ecuación is in serif, but 0.1 and 0.2 are sans serif.



      I tried things like:



      renewcommand{thetable}{sffamilythechapter.arabic{table}}


      but doing so ruins the formatting of the captions.



      Is there any way of getting all cross references in sans serif? Thanks.







      fonts cross-referencing ref autoref






      share|improve this question







      New contributor




      Pertrecho 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




      Pertrecho 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




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









      asked 2 hours ago









      Pertrecho

      1




      1




      New contributor




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





      New contributor





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






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






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The cleveref package does all the hard work for you:



          documentclass[twoside, 11pt,spanish]{book}
          usepackage[utf8]{inputenc}
          usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
          %renewcommand{theequation}{sffamilythechapter.arabic{equation}}
          %renewcommand{thetable}{thechapter.arabic{figure}}
          usepackage[font={sf, footnotesize}]{caption}
          usepackage[colorlinks=true]{hyperref}

          usepackage[capitalise,nameinlink,noabbrev]{cleveref}


          makeatletter
          def@setcref{sffamily@@setcref{cref}}%
          makeatother

          begin{document}

          Este texto es sólo para incluir las referencias a la cref{tab:prueba}, la cref{eq:ecuacion1,eq:ecuacion2}.

          begin{table}
          begin{center}
          caption{Prueba de tabla.}
          label{tab:prueba}
          begin{tabular}{c c c}
          Columna 1 & Columna 2 & Resultados\
          1 & 1 & 2
          end{tabular}
          end{center}
          end{table}

          begin{equation}
          label{eq:ecuacion1}
          1 + 1 = 2
          end{equation}

          begin{equation}
          label{eq:ecuacion2}
          1 + 1 = 2
          end{equation}

          end{document}


          enter image description here






          share|improve this answer








          New contributor




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


















            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',
            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
            });


            }
            });






            Pertrecho 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%2f463207%2ffont-style-in-ref-and-autoref%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            The cleveref package does all the hard work for you:



            documentclass[twoside, 11pt,spanish]{book}
            usepackage[utf8]{inputenc}
            usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
            %renewcommand{theequation}{sffamilythechapter.arabic{equation}}
            %renewcommand{thetable}{thechapter.arabic{figure}}
            usepackage[font={sf, footnotesize}]{caption}
            usepackage[colorlinks=true]{hyperref}

            usepackage[capitalise,nameinlink,noabbrev]{cleveref}


            makeatletter
            def@setcref{sffamily@@setcref{cref}}%
            makeatother

            begin{document}

            Este texto es sólo para incluir las referencias a la cref{tab:prueba}, la cref{eq:ecuacion1,eq:ecuacion2}.

            begin{table}
            begin{center}
            caption{Prueba de tabla.}
            label{tab:prueba}
            begin{tabular}{c c c}
            Columna 1 & Columna 2 & Resultados\
            1 & 1 & 2
            end{tabular}
            end{center}
            end{table}

            begin{equation}
            label{eq:ecuacion1}
            1 + 1 = 2
            end{equation}

            begin{equation}
            label{eq:ecuacion2}
            1 + 1 = 2
            end{equation}

            end{document}


            enter image description here






            share|improve this answer








            New contributor




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






















              up vote
              0
              down vote













              The cleveref package does all the hard work for you:



              documentclass[twoside, 11pt,spanish]{book}
              usepackage[utf8]{inputenc}
              usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
              %renewcommand{theequation}{sffamilythechapter.arabic{equation}}
              %renewcommand{thetable}{thechapter.arabic{figure}}
              usepackage[font={sf, footnotesize}]{caption}
              usepackage[colorlinks=true]{hyperref}

              usepackage[capitalise,nameinlink,noabbrev]{cleveref}


              makeatletter
              def@setcref{sffamily@@setcref{cref}}%
              makeatother

              begin{document}

              Este texto es sólo para incluir las referencias a la cref{tab:prueba}, la cref{eq:ecuacion1,eq:ecuacion2}.

              begin{table}
              begin{center}
              caption{Prueba de tabla.}
              label{tab:prueba}
              begin{tabular}{c c c}
              Columna 1 & Columna 2 & Resultados\
              1 & 1 & 2
              end{tabular}
              end{center}
              end{table}

              begin{equation}
              label{eq:ecuacion1}
              1 + 1 = 2
              end{equation}

              begin{equation}
              label{eq:ecuacion2}
              1 + 1 = 2
              end{equation}

              end{document}


              enter image description here






              share|improve this answer








              New contributor




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




















                up vote
                0
                down vote










                up vote
                0
                down vote









                The cleveref package does all the hard work for you:



                documentclass[twoside, 11pt,spanish]{book}
                usepackage[utf8]{inputenc}
                usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
                %renewcommand{theequation}{sffamilythechapter.arabic{equation}}
                %renewcommand{thetable}{thechapter.arabic{figure}}
                usepackage[font={sf, footnotesize}]{caption}
                usepackage[colorlinks=true]{hyperref}

                usepackage[capitalise,nameinlink,noabbrev]{cleveref}


                makeatletter
                def@setcref{sffamily@@setcref{cref}}%
                makeatother

                begin{document}

                Este texto es sólo para incluir las referencias a la cref{tab:prueba}, la cref{eq:ecuacion1,eq:ecuacion2}.

                begin{table}
                begin{center}
                caption{Prueba de tabla.}
                label{tab:prueba}
                begin{tabular}{c c c}
                Columna 1 & Columna 2 & Resultados\
                1 & 1 & 2
                end{tabular}
                end{center}
                end{table}

                begin{equation}
                label{eq:ecuacion1}
                1 + 1 = 2
                end{equation}

                begin{equation}
                label{eq:ecuacion2}
                1 + 1 = 2
                end{equation}

                end{document}


                enter image description here






                share|improve this answer








                New contributor




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









                The cleveref package does all the hard work for you:



                documentclass[twoside, 11pt,spanish]{book}
                usepackage[utf8]{inputenc}
                usepackage[spanish, es-noindentfirst, es-nosectiondot]{babel}
                %renewcommand{theequation}{sffamilythechapter.arabic{equation}}
                %renewcommand{thetable}{thechapter.arabic{figure}}
                usepackage[font={sf, footnotesize}]{caption}
                usepackage[colorlinks=true]{hyperref}

                usepackage[capitalise,nameinlink,noabbrev]{cleveref}


                makeatletter
                def@setcref{sffamily@@setcref{cref}}%
                makeatother

                begin{document}

                Este texto es sólo para incluir las referencias a la cref{tab:prueba}, la cref{eq:ecuacion1,eq:ecuacion2}.

                begin{table}
                begin{center}
                caption{Prueba de tabla.}
                label{tab:prueba}
                begin{tabular}{c c c}
                Columna 1 & Columna 2 & Resultados\
                1 & 1 & 2
                end{tabular}
                end{center}
                end{table}

                begin{equation}
                label{eq:ecuacion1}
                1 + 1 = 2
                end{equation}

                begin{equation}
                label{eq:ecuacion2}
                1 + 1 = 2
                end{equation}

                end{document}


                enter image description here







                share|improve this answer








                New contributor




                book 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 answer



                share|improve this answer






                New contributor




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









                answered 56 mins ago









                book

                425111




                425111




                New contributor




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





                New contributor





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






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






















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










                    draft saved

                    draft discarded


















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













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












                    Pertrecho 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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f463207%2ffont-style-in-ref-and-autoref%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

                    Entries order in /etc/network/interfaces

                    新発田市

                    Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)