Font Awesome in the PDF build

155 views
Skip to first unread message

Stefano David

unread,
Jan 31, 2019, 1:06:57 PM1/31/19
to sphinx-users
Hi,

I am unsuccessfully trying to have a couple of icons from Fonts Awesome included into a PDF via the latex builder. My setup is as follows.

In conf. py I have (Only relevant options reported, the latex_elements is quite long and complex)

*****
import sphinx_fontawesome
extensions = ['sphinx.ext.ifconfig' , 'sphinx_fontawesome','sphinx.ext.todo' ]  
latex_elements['preamble'] = """
\\usepackage{fontawesome}
"""
*****

In the rst file:

*****
To move all oll usersfrom a column to the other, click on the
:fa:`angle-double-right` or :fa:`angle-double-left` icons on
top of the columns.
*****

In the latex output, however, I just have

*****To move all oll usersfrom a column to the other, click on the
\sphinxstyleemphasis{} or \sphinxstyleemphasis{} icons on
top of the columns.*****

So, I wonder if this is actually possible or supported.

Any hint will be appreciated, thanks!
Stefano

Komiya Takeshi

unread,
Feb 1, 2019, 4:19:21 AM2/1/19
to sphinx...@googlegroups.com
AFAIK, font-awesome is a technology only for HTML and CSS. So it would
not work for LaTeX.

Thanks,
Takeshi KOMIYA

2019年2月1日(金) 3:07 Stefano David <ste...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To post to this group, send email to sphinx...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

Nicholas Bastin

unread,
Feb 1, 2019, 4:41:33 AM2/1/19
to sphinx...@googlegroups.com
On Fri, Feb 1, 2019 at 4:19 AM Komiya Takeshi <i.tk...@gmail.com> wrote:
AFAIK, font-awesome is a technology only for HTML and CSS. So it would
not work for LaTeX.

fontawesome does work in LaTeX using the .otf fonts through the fontawesome package (https://ctan.org/pkg/fontawesome).  Unfortunately it appears that the sphinx_fontawesome extension doesn't know how to generate the \faicon{...} syntax necessary for rendering the icons in LaTeX documents.

--
Nick 

Komiya Takeshi

unread,
Feb 1, 2019, 5:15:29 AM2/1/19
to sphinx...@googlegroups.com
Oh, I don't know that. It would be nice if sphinx_fontawesome supports
LaTeX output :-)

2019年2月1日(金) 18:41 Nicholas Bastin <nick....@gmail.com>:

jfbu

unread,
Feb 1, 2019, 1:58:54 PM2/1/19
to sphinx...@googlegroups.com
Hi Nick

maybe make a feature request at their project ?

https://github.com/fraoustin/sphinx_fontawesome

the LaTeX fontawesome package (you gave CTAN link) is available via seems to support all three of xelatex, lualatex, and pdflatex as it provides conversion of the otf fonts for the latter

(not sure about platex for Japanese documents)

Best,

Jean-François

jfbu

unread,
Feb 1, 2019, 2:05:05 PM2/1/19
to sphinx...@googlegroups.com
sorry I sent before completing my sentence :

the LaTeX fontawesome package (you gave CTAN link) is available via TeXLive/MikTeX distributions hence probably on Ubuntu/Debian etc based distros, and it seems to support all three of xelatex, lualatex, and pdflatex as it provides conversion of the otf fonts for the latter

Stefano David

unread,
Feb 4, 2019, 4:33:55 AM2/4/19
to sphinx-users
Hi,

Thanks to all for your answers.

On Friday, 1 February 2019 20:05:05 UTC+1, jfbu wrote:

the LaTeX fontawesome package (you gave CTAN link) is available via TeXLive/MikTeX distributions hence probably on Ubuntu/Debian etc based distros, and it seems to support all three of xelatex, lualatex, and pdflatex as it provides conversion of the otf fonts for the latter

Yes, that package is installed on my system, that's why I was wondering because it does not work. I can produce successfully documents with FA in HTML from sphinx and in PDF via Latex, but I am missing the step to let the latex/latexpdf builder/writer convert correctly the fonts. I will try to tweak my preamble in conf.py, and if I am not successfull, I'll open an improvement request to the sphinx_fontawesome project.

@Komiya: yes, it's a CSS thing, but it's also well supported in LaTeX :-) It would be great to support it in latex builder!

Thanks again,
Stefano

Komiya Takeshi

unread,
Feb 6, 2019, 7:42:25 AM2/6/19
to sphinx...@googlegroups.com
Hi,

>@Komiya: yes, it's a CSS thing, but it's also well supported in LaTeX :-) It would be great to support it in latex builder!

It's responsibility of extensions, not LaTeX builder. So please post
an improvement request to sphinx_fontawesome project :-)

Thanks,
Takeshi KOMIYA

2019年2月4日(月) 18:33 Stefano David <ste...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages