基於影像的方法

基於影像的方法

這本身就很難用谷歌搜尋。有人告訴我可以Google在 LaTeX 中的常規文字中使用該徽標,但我正在努力找出如何使用。

例如:

Some words, then {Google Logo here} and then so on...

答案1

基於影像的方法

縮放並不完美,但非常接近。基本概念是將圖像的高度設定為當前字體的高度G和深度總和。g然後將影像降低 深度以g嘗試對齊基線。

不幸的是,此方法依賴於徽標字體相對於 TeX 文件中使用的字體的下降深度和大寫字母高度。可能需要稍微調整。我將徽標下載為 SVG 圖像,並將其轉換為 PDF 以供使用\includegraphics

\protected\def是為了使該命令可以用於移動參數。如果hyperref使用,您可能還需要\texorpdfstring或類似的書籤/等。

\documentclass{article}
\usepackage{calc,graphicx}
\newlength\htG\newlength\dpg
\protected\def\google{\settoheight{\htG}{G}\settodepth{\dpg}{g}%
  \raisebox{-\dpg}{\includegraphics[height=\htG+\dpg]{Google_2015_logo}}}

\title{\google\ in the title}
\author{A \google r}

\begin{document}
\maketitle
\section{\google\ in a section}
\google\ all around!
\end{document}

在此輸入影像描述


SVG 路徑方法(附星際大戰- 啟發測試程式碼)

除了基於圖像的方法之外,我們可以使用 TikZ 的svg.path函式庫並直接從 Google 的 SVG 檔案借用每個字母的路徑。這使我們能夠在“l”矩形的底部更精確地設定基線(這就是首先繪製它的原因)。不過,主要思想與原始方法非常相似。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{svg.path}
\definecolor{gG}{RGB}{ 60, 186,  84}
\definecolor{gY}{RGB}{244, 194,  13}
\definecolor{gB}{RGB}{ 72, 133, 237}
\definecolor{gR}{RGB}{219,  50,  54}

\newlength\htG
\protected\def\google{\settoheight{\htG}{G}%
  \begin{tikzpicture}[yscale=-1,scale=(\htG/240pt),baseline=(baseline)]
    \fill[fill=gG] svg {m797.49 249.7h35.975v-240.75h-35.975z};
    \coordinate (baseline) at (current bounding box.south);
    \fill[fill=gB] svg {m246.11 116.18h-116.57v34.591h82.673c-4.0842 48.506-44.44 69.192-82.533 69.192-48.736 0-91.264-38.346-91.264-92.092 0-52.357 40.54-92.679 91.371-92.679 39.217 0 62.326 25 62.326 25l24.22-25.081s-31.087-34.608-87.784-34.608c-72.197-0.001-128.05 60.933-128.05 126.75 0 64.493 52.539 127.38 129.89 127.38 68.031 0 117.83-46.604 117.83-115.52 0-14.539-2.1109-22.942-2.1109-22.942z};
    \fill[fill=gR] svg {m341.6 91.129c-47.832 0-82.111 37.395-82.111 81.008 0 44.258 33.249 82.348 82.673 82.348 44.742 0 81.397-34.197 81.397-81.397 0-54.098-42.638-81.959-81.959-81.959zm0.47563 32.083c23.522 0 45.812 19.017 45.812 49.66 0 29.993-22.195 49.552-45.92 49.552-26.068 0-46.633-20.878-46.633-49.79 0-28.292 20.31-49.422 46.741-49.422z};
    \fill[fill=gY] svg {m520.18 91.129c-47.832 0-82.111 37.395-82.111 81.008 0 44.258 33.249 82.348 82.673 82.348 44.742 0 81.397-34.197 81.397-81.397 0-54.098-42.638-81.959-81.959-81.959zm0.47562 32.083c23.522 0 45.812 19.017 45.812 49.66 0 29.993-22.195 49.552-45.92 49.552-26.068 0-46.633-20.878-46.633-49.79 0-28.292 20.31-49.422 46.741-49.422z};
    \fill[fill=gB] svg {m695.34 91.215c-43.904 0-78.414 38.453-78.414 81.613 0 49.163 40.009 81.765 77.657 81.765 23.279 0 35.657-9.2405 44.796-19.847v16.106c0 28.18-17.11 45.055-42.936 45.055-24.949 0-37.463-18.551-41.812-29.078l-31.391 13.123c11.136 23.547 33.554 48.103 73.463 48.103 43.652 0 76.922-27.495 76.922-85.159v-146.77h-34.245v13.836c-10.53-11.347-24.93-18.745-44.04-18.745zm3.178 32.018c21.525 0 43.628 18.38 43.628 49.768 0 31.904-22.056 49.487-44.104 49.487-23.406 0-45.185-19.005-45.185-49.184 0-31.358 22.619-50.071 45.66-50.071z};
    \fill[fill=gR] svg {m925.89 91.02c-41.414 0-76.187 32.95-76.187 81.57 0 51.447 38.759 81.959 80.165 81.959 34.558 0 55.768-18.906 68.426-35.845l-28.235-18.787c-7.3268 11.371-19.576 22.484-40.018 22.484-22.962 0-33.52-12.574-40.061-24.754l109.52-45.444-5.6859-13.318c-10.58-26.08-35.26-47.86-67.92-47.86zm1.4268 31.413c14.923 0 25.663 7.9342 30.224 17.447l-73.139 30.57c-3.1532-23.667 19.269-48.017 42.915-48.017z};
  \end{tikzpicture}%
}

% just for the testing section
\newcommand{\testing}[1]{\noindent\leavevmode#1\rlap{G}\google\llap{e} \quad \rlap{Google}\google \qquad \google\llap{Google}\par}

\title{\google\ in the title}
\author{A \google r}

\begin{document}
\maketitle
\section{\google\ in a section}
\google\ all around! 

\section{Some testing code}
\testing{\tiny}
\testing{\scriptsize}
\testing{\footnotesize}
\testing{\small}
\testing{\normalsize}
\testing{\large}
\testing{\Large}
\testing{\LARGE}
\testing{\huge}
\testing{\Huge}
\end{document}

在此輸入影像描述

答案2

你的意思是這樣嗎:

\documentclass[12pt]{book}

\usepackage{fontawesome}

\begin{document}
Some foo text with \faGoogle
\end{document}

更新Futura-Normal字體並使用XeLaTeX.顏色定義取自谷歌新標誌,字體是Product Sans,但是這個字體不是免費的,所以我選擇Futura-Normal(http://allfont.net/download/futura-normal/

\documentclass[12pt]{book}
\usepackage{xcolor}
\usepackage{fontspec}

\definecolor{GoogleGreen}{RGB}{60, 186, 84}
\definecolor{GoogleYellow}{RGB}{244, 194, 13}
\definecolor{GoogleBlue}{RGB}{72, 133, 237}
\definecolor{GoogleRed}{RGB}{219, 50, 54}
\newcommand{\GoogleLogo}{{\setmainfont{futura-Normal}\textcolor{GoogleBlue}{G}\textcolor{GoogleRed}{o}\textcolor{GoogleYellow}{o}\textcolor{GoogleBlue}{g}\textcolor{GoogleGreen}{l}\textcolor{GoogleRed}{e}}}

\begin{document}
\huge \GoogleLogo

Some foo text with 
\end{document}

在此輸入影像描述

答案3

我的回答在從向量圖形創建乳膠符號這樣做(使用舊的谷歌徽標)。我已將此處的徽標更新為 David 引用的徽標(https://www.google.co.uk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png),並稍微調整了參數。

\documentclass{article}
\usepackage{scalerel}
\def\theirlogo{%
  \scalerel*{\includegraphics{googlelogo_color_272x92dp}}{X\rule[-.55ex]{0pt}{1pt}}}
\begin{document}
\Huge Google \theirlogo{}

\normalsize Can I insert my \theirlogo{} inline?

\tiny Can I insert my \theirlogo{} inline?
\end{document}

在此輸入影像描述

答案4

另一個基於文字的假標誌。不完美,但幾乎...

姆韋

註:編譯win xelatex.這些.ttf是可用的開源字體谷歌字體

\documentclass[12pt]{article}
\usepackage[export]{adjustbox} % just to valign the .png 

\usepackage{xcolor}
\usepackage{fontspec}
\definecolor{B}{HTML}{4285F4}
\definecolor{R}{HTML}{EA4335}
\definecolor{Y}{HTML}{FBBC05}
\definecolor{G}{HTML}{34A853}

\newcommand{\Google}{%
\textcolor{B}{\setmainfont{Poppins-Medium} G}%
{\setmainfont{JosefinSans-Bold}%
\textcolor{R}{o}%
\textcolor{Y}{o}%
\textcolor{B}{g}%
\textcolor{G}{l}%
\textcolor{R}{e}}}

\usepackage{graphicx}
\begin{document}
\tiny Fake \Google\ logo\par
\normalsize Fake \Google\ logo\par
\Large Fake \Google\ logo\par
\Huge Fake \Google\ logo\par
\bigskip\hrule\bigskip
\normalsize Real \verb|.png| logo: 
\includegraphics[valign=c,height=2.5ex]{Escritorio/googlelogo_color_272x92dp.png}  
\end{document}

相關內容