我在文档类tikz
中制作了一幅图画beamer
。我想知道如何在article
文档类中制作此图画,但保留默认主题中使用的无衬线字体和字体大小beamer
。
以下是LaTeX
使用beamer
文档类的代码:
\documentclass[notes=show,beamer,usenames,dvipsnames]{beamer}
\usepackage{tikz}
\setbeamertemplate{navigation symbols}{}
\setbeamersize{text margin left=1em,text margin right=1em}
\begin{document}
\begin{frame}
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\end{frame}
\end{document}
这是文档类中的绘图article
:
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\end{document}
我希望后者使用与前者相同的字体和字体大小,包括在数学模式下。
答案1
在答案中可以看到如何进行局部更改(仅针对图片)或为整篇文章设置无衬线字体。
本地更改
要进行本地更改,您可以按以下步骤操作:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{sansmath} % math sans serif font
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\begin{sansmath}
\fontencoding{\encodingdefault}
\fontfamily{\sfdefault}
\fontseries{\seriesdefault}
\fontshape{\shapedefault}
\selectfont
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\end{sansmath}
\fontencoding{\encodingdefault}
\fontfamily{\rmdefault}
\fontseries{\seriesdefault}
\fontshape{\shapedefault}
\selectfont
\lipsum[1]
\[x+y=\dfrac{z}{3}\]
\end{document}
结果:
全球变化
如果您的目的是将整个文档设置为无衬线字体,您可以这样做:
\documentclass{article}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\sfdefault} %%
\usepackage{sfmath}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[yscale=3.5,xscale=4.5]
\draw[->] (0,0) -- (2,0) node[below, text width=2cm] {Before Tax Income $z$};
\draw[->] (0,0) -- (0,2) node[below left, text width=1.8cm] {After Tax Income $z - T(z)$};
\begin{scope}
\clip (0,0) rectangle (1,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\begin{scope}
\clip (1,0) rectangle (2,2);
\draw (0,0) -- (1.5,1.5);
\end{scope}
\draw[rotate around={45:(1,1)},red] (.6,1.1) node[left] {$L$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.125,.125)},rotate around={45:(1,1)},cyan] (.6,1.1) node[left] {$M$} parabola bend (1,1) (1.4,1.1);
\draw[shift={(.25,.25)},rotate around={45:(1,1)},ForestGreen] (.6,1.1) parabola bend (1,1) (1.4,1.1) node[right] {$H$};
\draw[dashed] (1,0) node[below] {\textcolor{red}{$z^{*}$}} -- (1,2);
\draw[dashed] (1.25,0) node[below] {\textcolor{ForestGreen}{$z^{*}+\triangle z^{*}$}} -- (1.25,2);
\path (.15,.1) node[right] {slope = $1-t$};
\end{tikzpicture}
\lipsum[1]
\[x+y=\dfrac{z}{3}\]
\end{document}
结果: