20

I want to use a smartphone symbol.

Naturally, I went to How to look up a symbol or identify a math symbol or character?, but I wasn't able to find any smartphone look-alike (only old phones, and the mobile one looks like a Blackberry, as opposed to a nowadays standard smartphone).

I was able to find the type of symbol I'm looking for within the answers of these two questions:

  1. https://tex.stackexchange.com/a/173165/27833
  2. https://tex.stackexchange.com/a/223105/27833

But, unfortunately, they both seem to work only with the fontspec package... and require either XeLaTeX or LuaLaTeX.

Is there any option to get the smartphone symbol for pdfLaTeX?

4 Answers 4

43

A mobile phone using direct \pdfliteral should look like this:

\def\mobile{\leavevmode\hbox to7bp{\kern1bp \lower1bp\vbox to12bp{}%
    \pdfliteral{q 0 g 0 G 1 j 2 w 0 0 5 10 re B
       1 g 1 G 1 w .3 1.8 4.4 7 re B 
       1.5 w 2.5 .2 0 .1 re B .3 w 1.7 10 1.6 0 re B Q}%
    \hss}}

Mobile: \mobile

Result: mobile

Edit: Maybe you need scaled version of this. The next version of \mobile macro has one parameter which is the scaling coefficient. You can compare with the previous "nonscaled" macro.

\newdimen\bpt
\def\mobile#1{\leavevmode 
   \bpt=#1bp \hbox to7\bpt{\kern1\bpt \lower1\bpt\vbox to12\bpt{}%
      \pdfliteral{q #1 0 0 #1 0 0 cm 1 j 2 w 0 0 5 10 re B 
         1 g 1 G  1 w .3 1.8 4.4 7 re B 
         1.5 w 2.5 .2 0 .1 re B .3 w 1.7 10 1.6 0 re B Q}%
      \hss}}

Mobile: \mobile{1}, \mobile{3.2}, \mobile{.2}.
7
  • 7
    OK fancypants, you are a repeat offender: tex.stackexchange.com/questions/234797/…, tex.stackexchange.com/questions/236287/…. +1 May 6, 2015 at 18:44
  • For some reason I'm not getting the white circle at the bottom May 6, 2015 at 18:50
  • 8
    ...meaning "I wish I was as talented." May 6, 2015 at 18:53
  • 3
    @MarioS.E. Uh, it seems that Adobe has not so good PDF rasterizer :(. I did try this on PDF viewer based on poppler library. Now, I added a little hack to my code, so Adobe draws the white circle too.
    – wipet
    May 6, 2015 at 19:04
  • 4
    Why \def instead \newcommand? Did you see that I ever used \newcommand? Never! Because I want my codes are applicable in various TeX macro packages. And if you need to not change line spacing then simply remove the dynamically calculated strut \lower1\bpt\vbox to12\bpt{}.
    – wipet
    May 7, 2015 at 11:58
12

Create a document with only one symbol in it:

\documentclass{article}
\usepackage{fontawesome}

\pagestyle{empty}
\begin{document}
\Huge\faMobilePhone
\end{document}

Process it with lualatex and pdfcrop and \includegraphics the result in your document and run pdflatex on it.


EDIT1: Thanks to Heiko Oberdiek
A one-stop solution is to use standalone class:

\documentclass{standalone}
\usepackage{fontawesome}

\begin{document}
\Huge\faMobilePhone
\end{document}

You run lualatex on this file and get a ready cropped pdf file which you can include in your source file with \includegraphics.


EDIT2: fontinst can be cumbersome, but it still gives one full control when installing fonts, even in otf era.

enter image description here

3
  • With class standalone neither \pagestyle{empty} nor pdfcrop are needed. May 6, 2015 at 18:03
  • @HeikoOberdiek - I like to use your software but standalone is more efficient here :-) Thanks for the hint; I wasn't aware of it. May 6, 2015 at 18:08
  • Get your answer a little more polished and I'll accept it :) Keep in mind (and add examples) of both the creation of the .pdf and the insertion of it inside the main file. You can get some inspiration from both HeikoOberdiek and Steven B. Segletes May 6, 2015 at 18:41
10

Just find a suitable graphic, e.g., http://trendafrica.co.za/wp-content/uploads/2013/01/Smartphone-icon.jpg, and place it in a macro that scales it to size.

\documentclass{article}
\usepackage{graphicx}
\def\smartphone{\includegraphics[height=\ht\strutbox]{Smartphone-icon}}
\begin{document}
Text \smartphone
\end{document}

enter image description here

3
  • As of now that's what I'm using as work-around, but I was hoping of a more "native" version i.e., a symbol from a package (like with fontawsome in the answer provided by Werner, but for pdfLaTeX). My first try actually consisted in rendering a TikZ picture out of the image. May 6, 2015 at 18:00
  • Is there any special reason to use \def as opposed to newcommand? What is the deal with the height=\ht\strutbox thing? May 6, 2015 at 18:35
  • @MarioS.E. Use of \def is laziness (I should know better). The \ht\strutbox specification scales the image, no matter what its original size, to something that sits on the baseline and extends up to, but not beyond the line above it (i.e. it will not change the line spacing, nor will it interfere with text above it). May 6, 2015 at 18:38
6

You can use with XeLateX or LuaLaTeX the \faMobile command, from package fontawesome.

You also can use the Smartphone Icons, downloadable from this site, which has an extensive set of icons:

\documentclass[12pt]{article}
\usepackage{array}
\usepackage{fontawesome}

\begin{document}

\texttt{Font Awesome: }\vskip2ex

Text text text \faMobilePhone\vskip3ex

\texttt{Smartphone Icons: }\vskip2ex

Text text text {\fontspec{Smartphone Icons}\begin{tabular}[t]{*{10}{c}}
\noalign{\fontspec{Smartphone Icons}}
a & b & c & d & e & f & g & h & i & j \\
k & l & m &n & o & p & q & r & s & t
\end{tabular}}

\end{document} 

enter image description here

2
  • 2
    nice, but not really an answer to the OP. pdfLaTeX was mandatory here. Maybe you transfer the whole thing to tex.stackexchange.com/q/16586. Would be nice.
    – LaRiFaRi
    May 6, 2015 at 21:52
  • 1
    @Larifari: Would be nicer if I created to necessary files for use with LaTeX. I'll try to find a moment in the next few days (but I haven't done such a job for years!).
    – Bernard
    May 6, 2015 at 22:14

You must log in to answer this question.

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