FontAwesome - Change Icon colours Latex - latex

came across FontAwesome icon package. When shifting through the documentation I cam across:
{\color{color-name} text and/or icon }
However, this does not seem to work for me. Anyone know what is the correct format for changing the colour of icons?
Thanks
EDIT:
\documentclass[border=0.1cm]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{fontawesome5}
\usepackage[hidelinks]{hyperref}
\begin{document}
\begin{minipage}[t]{0.275\textwidth} % 27.5% of the page width for the first row of icons
\vspace{-\baselineskip} % Required for vertically aligning minipages
{\color{Blue} \icon{Globe}{12}{\href{someAddress}{someAdd}}}\\
\end{minipage}
\end{document}

if you want to use \href, you must load the hyperref package
you are opening one more { than you are closing
if you want to use an icon from fontawsome5, either use \fa<insert name here> or \faIcon{<insert name here>}, e.g. \fGlobe in your case.
\documentclass[border=1cm]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage{fontawesome5}
\begin{document}
\begin{minipage}[t]{0.275\textwidth} % 27.5% of the page width for the first row of icons
\vspace{-\baselineskip} % Required for vertically aligning minipages
{\color{Blue} \faGlobe \faIcon{globe} \href{someAddress}{someAdd} }\\
\end{minipage}
\end{document}

Related

Caption Centered To Image Rather Than Page

There isn't exactly any code here, since I just want to centre \begin{figure} and \end{figure}'s captions to the entre of the image included rather than to the centre of the page, if i centre the image to the left, the caption still appears to the centre of the page (without using minipage as that is the only way i know to do it right now).
Here's an example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h]
\includegraphics[width=0.5\textwidth]{image.png}
\caption{Caption}
\end{figure}
\end{document}
What I get from compiling it:
I want this be centered to the image itself, and not the page, without using minipage.
Here is the source image btw, just some image I found on google
One possible approach using the varwidth package:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{varwidth}
\begin{document}
\begin{figure}[h]
\begin{varwidth}{\linewidth}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\caption{Caption}
\end{varwidth}
\end{figure}
\end{document}

latex - Remove pale blu box around image-link only to a specific position

I like to make a question on the hyperref package of Latex. I write reports with the company's logo and I would like to add an implicit link to the official company's website, so as that if someone click on this logo can open the official web page. The problem is that this generates a bad pale blue box that is particularly ugly, therefore I would like to remove it.
I was able to remove all the box on the external link by changing the color on the specification (and setting white, perhaps there is also a way to remove) but I am trying to change only on this specific link and not all the others present other parts of the document.
Below the portion of latex code:
\documentclass[11pt]{article}
\usepackage[italian]{babel}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{figure}[h!]
\vspace{-1 cm}
\flushleft\hspace{-1.5 cm}
\href{https://www.link.com/}{\includegraphics[height=1.5cm, keepaspectratio]{LOGO1.jpg}}
%\caption{Caption}\label{fig:logo}
\end{figure}
\end{document}
Do somebody knows a special tricks for doing this? Thank you in advance for any help.
You can change the hyperref setup locally:
\documentclass[11pt]{article}
\usepackage[italian]{babel}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\begin{document}
\begin{figure}[h!]
\vspace{-1 cm}
\flushleft\hspace{-1.5 cm}
{\hypersetup{hidelinks}\href{https://www.link.com/}{\includegraphics[height=1.5cm, keepaspectratio]{example-image-duck}}}
%\caption{Caption}\label{fig:logo}
\end{figure}
\end{document}

How to resize emoji image using scalerel

I want to insert emojis in latex table and for this I have followed all steps as done in http://www.thetawelle.de/?p=5539
But the size of emoji is very small. I need help as to how to increase size of emoji in the table.
\usepackage{scalerel}
\def\emojif60d{\scalerel*{\includegraphics{f60d.pdf}}{O}}
In the the table I have used: \emojif60d.
You do not need scalerel. It is mostly useful for scaling text, math, etc.
There is all that is required in the \includegraphics macro.
either scale=<scale_factor>
or width=<desired_width> (or height=<desired_height>)
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\includegraphics[scale=0.5]{1F600}&
\includegraphics[scale=1]{1F600}&
\includegraphics[scale=2]{1F600}&
\includegraphics[scale=4]{1F600}&
\includegraphics[scale=8]{1F600}\\\hline
\includegraphics[width=0.25cm]{1F600}&
\includegraphics[width=0.5cm]{1F600}&
\includegraphics[width=1cm]{1F600}&
\includegraphics[width=2cm]{1F600}&
\includegraphics[width=8cm]{1F600}\\
\hline
\end{tabular}
\end{document}
To scale all occurrences of the emoji, you could include the scale in the definition, e.g.
\documentclass{article}
\usepackage{scalerel}
\def\emojif60d{\includegraphics[width=2em]{1F60D.pdf}}
\begin{document}
\emojif60d
\end{document}
If it should only be scaled sometimes, you could use \scalebox from the graphicx package or use a bigger font size, e.g.
\documentclass{article}
\usepackage{scalerel}
\def\emojif60d{\scalerel*{\includegraphics{1F60D.pdf}}{O}}
\begin{document}
\scalebox{3}{\emojif60d}
\emojif60d
\Huge\emojif60d
\end{document}
The latter approach will have the advantage that you will still be able to use the emoji inside of normal text and the size will be adapted to the font size.

Control white space of section locally on latex

is there a way to control the white space above just one specific section in latex? Most solutions I've found rely on the titlesec package, but as far as I know that would change every section.
Thanks for the help!
Use \vspace*{length} command, just before your section begins. For example:
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum
\section{Section 1}
\lipsum
\vspace*{1cm}
\section{Section moved down}
\lipsum
\end{document}
moves the second section 1cm down.

Latex: center text within listing

How do I center text within a listing in Latex?
Or another way not using listing. (Need a box with monospace font)
The answer given at tex.stackexchange is:
\documentclass{article}
\usepackage{listings}
\renewcommand{\figurename}{Listing}
% replace figurename with the text that should preceed the caption
\begin{document}
\begin{figure}[thp] % the figure provides the caption
\centering % which should be centered
\caption{Ausgabe des C-Programms}
\begin{tabular}{c} % the tabular makes the listing as small as possible and centers it
\begin{lstlisting}[label={gtt_c_ausgabe}]
printf("Your code goes here.\n");
\end{lstlisting}
\end{tabular}
\end{figure}
\end{document}
...which still leaves me wondering:
Using a frame around the code, e.g. using \lstset{frame=single,frameround=tttt}, places the frame way over to the right. How can this be avoided?
What does the renewcommand bit do?
I don't have an answer for the listing package on top of my head, but you could try the following:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\tt Hello World\\Second line}}
That produces a box with 90% of the line width, with text of width 85% of line width.
If you want it centered you just put \centering in front of the \tt command:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\centering \tt Hello World\\Second line}}
If you prefer the box without a frame, simply change \framebox into \makebox (and keep the arguments as they stand).

Resources