1

I wish to change the default sans serif to roboto and use it for a water mark.

Roboto

When I pass a value to the fontfamily keyword of the \newwatermark function, the entire document changes font to sans serif. To prevent this I added \renewcommand{\familydefault}{\rmdefault}.

However, the code below does not assign sfdefault to fontfamily. According to the xwatermark manual, fontfamily expects one of the default fonts, such as crm. I could not find a corresponding abbreviation of roboto.

How can I change the default sans serif font and set the watermark only to that value?

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}

\title{T}
\author{AU}
\date{July 2016}

\usepackage[printwatermark]{xwatermark}
\usepackage[gray]{xcolor}    
\usepackage[sfdefault]{roboto}    
\usepackage[T1]{fontenc}
\newwatermark[allpages,fontfamily=sfdefault,color=gray!25!white!50,angle=45,scale=4,xpos=0,ypos=0]{DRAFT}

\renewcommand{\familydefault}{\rmdefault}

\begin{document}
\maketitle
\section{Introduction}
Lorem Ipsum
\section{Background}
Lorem ipsum... and then some
\end{document}
  • 1
    It'd be nice to have a fully compilable code… – Bernard Jul 10 '16 at 12:03
  • @Bernard Consider it done. – noumenal Jul 10 '16 at 12:08
  • A (hypothetically) last question: do you want roboto to be tthe default sans serif font only for the watermark, or for the whole document? – Bernard Jul 10 '16 at 12:13
  • @Bernard For the entire document, but that is not my priority. – noumenal Jul 10 '16 at 22:14
  • My code realises that. – Bernard Jul 10 '16 at 22:23
1

The name of (one of) the font family defined by the package is Roboto-LF. Note you misunderstood the meaning of the sfdefault option of roboto.sty: it means the \defaultfamily will be Roboto. Loading roboto.sty makes Roboto the default sans font, but doesn't touch upon the default family.

Also, the Roboto family has a rather large x-height as compared to Computer Modern or Latin Modern, so it should be scaled in case you use it in the body of your document.

Thus your code should simply be:

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} \title{T}
\author{AU}
\date{July 2016}

\usepackage[printwatermark, ]{xwatermark}
\usepackage[gray]{xcolor}
\usepackage[scale=0.82]{roboto}%
\usepackage[T1]{fontenc}
\newwatermark[allpages,fontfamily=Roboto-LF,color=gray!25!white!50,angle=45,scale=4,xpos=0,ypos=0]{DRAFT}

\begin{document}

\maketitle
\section{Introduction}
{\sffamily Lorem Ipsum}
\section{Background}
Lorem ipsum... \textsf{and then some}

\end{document} 

enter image description here

1

You should do fontfamily=\sfdefault

\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[printwatermark]{xwatermark}
\usepackage[gray]{xcolor}    
\usepackage{roboto}    
\newwatermark[
  allpages,
  fontfamily=\sfdefault,
  color=gray!25!white!50,
  angle=45,
  scale=4,
  xpos=0,
  ypos=0
]{DRAFT}

\title{T}
\author{AU}
\date{July 2016}

\begin{document}
\maketitle

{\Huge\sffamily\bfseries DRAFT} % just to check

\section{Introduction}
Lorem Ipsum
\section{Background}
Lorem ipsum... and then some
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.