0

I would like to use some icons that are not available in Font Awesome 5. The template I'm using uses \color to apply a colour to a font awesome icon, and it would be nice if the same command could be used to colourise an SVG image.

Here's my test document

\documentclass[11pt]{article}

% Packages

\usepackage{xcolor} \usepackage{graphicx}

% Document \begin{document} \color{red} \includegraphics[scale=0.3]{kotlin} \includegraphics{graphql} \includegraphics{go} \includegraphics{ts-logo-128} \end{document}

And here's a screenshot of the resulting PDF. enter image description here

In the comments, I've been advised to try following the answer here, after using inkscape to generate a PDF from the SVG file.

However, when I run

pdftk kotlin.pdf output kotlin-unc.pdf uncompress
sed 's/0.0.0.[rR][gG]/        /g' < kotlin-unc.pdf > kotlin-final.pdf

I get sed: RE error: illegal byte sequence. I am uncertain how to fix this.

[Original SVG files]{https://drive.google.com/drive/folders/1H6dSeMZq-AmV4mZ9cS7uFd1Qux-S0G0J?usp=drive_link} [Inkscape exported PDF files]{https://drive.google.com/drive/folders/13lzL77KTuBDJOpI8uuV77T1P74CMvliT?usp=drive_link}

Ogre
  • 113
  • The problem is probably that inkscape is not in your path. However as the icon won't change, I would open them once in inkscape and safe them as pdf. – samcarter_is_at_topanswers.xyz Oct 23 '23 at 21:17
  • @samcarter_is_at_topanswers.xyz, would that allow me to change the colour of the icon in LaTeX? If so, how? – Ogre Oct 23 '23 at 21:27
  • Sure! If the pdf has a filled shape without explicit colour, it will automatically adapt to the surrounding text colour (here a guide how to remove the explicit colour https://tex.stackexchange.com/a/535771/36296). If it has an explicit fill colour, you can use this trick: https://tex.stackexchange.com/a/453338/36296 – samcarter_is_at_topanswers.xyz Oct 23 '23 at 21:42
  • Can you share your .svg file so we can check if it has an explicit colour or not? – samcarter_is_at_topanswers.xyz Oct 23 '23 at 21:48
  • @samcarter_is_at_topanswers.xyz, I have a few SVG files. One of which definitely has colour. When I export the colour one as a PDF, I can use \includegraphics perfectly fine. But, I find that exporting some of the others seems to create a tiny image in a very large PDF, which seems to mean that rendering them in the LaTeX generated PDF gives me some blank pages. Should I make a whole new question focused specifically on these images? – Ogre Oct 23 '23 at 22:08
  • Inkscape has an option to crop the page to the content (File->Document Properties). – samcarter_is_at_topanswers.xyz Oct 23 '23 at 22:22
  • @samcarter_is_at_topanswers.xyz, I've edited the question to reflect the process you suggest, and where I'm getting stuck. I've also included a couple of Google Drive links, because you mentioned sharing the files earlier so they could be checked. – Ogre Oct 24 '23 at 04:22
  • Are you on a mac? I can reproduce the error with mac sed. Installing brew install gnu-sed and then doing /opt/homebrew/opt/gnu-sed/libexec/gnubin/sed 's/0.0.0.[rR][gG]/ /g' < star2.pdf > star3.pdf worked fine for me https://i.stack.imgur.com/NVWdW.png – samcarter_is_at_topanswers.xyz Oct 24 '23 at 13:46
  • I am, and your suggestion solved the problem. This works beautifully. Thanks for your help! – Ogre Oct 25 '23 at 07:09

0 Answers0