There is this command, to create an href link

\href{this is my text}{http://tex.stackexchange.com/q/275848/71471}

I want to change the this is my text to a rmfamily font (see the first line in the screen capture as an example)

Is there a way to do this?

  • \href have two arguments: \href{URL}{text} and write text in a LaTeX font. Please explain what do you mean.
    – Fran
    Commented Aug 18, 2017 at 8:49
  • hi @Fran, question updated.
    – Andy K
    Commented Aug 18, 2017 at 8:55
  • The Sans Serif family is in the second line, not in the first. Simply add \sffamily to the text part.
    – Fran
    Commented Aug 18, 2017 at 9:25
  • @Fran what is the name of the first line font, please? This is the one I want actually. Sorry for the confusion.
    – Andy K
    Commented Aug 18, 2017 at 9:26
  • Try with \rmfamily
    – Fran
    Commented Aug 18, 2017 at 9:28

1 Answer 1


The \href take two arguments: the first is the URL to be linked and the second the text showed in the link, so it should be:

\href{http://tex.stackexchange.com/q/275848/71471}{this is my text}

The command do not change the font style in any way, so often it will be already in roman (serifed) font family, that is the default text style in most document classes.

Otherwise, you can change using \textrm{<text>} or \rmfamily <text> since the braces of the argument limit the scope of the command:

\href{http://tex.stackexchange.com/q/275848/71471}{\textrm{this is my text}}
\href{http://tex.stackexchange.com/q/275848/71471}{\rmfamily this is my text}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .