我想将 pgfplot 中的“nodes near coord”的字体大小以及 y 刻度标签更改为 1pt(不用担心,这只是理论上的兴趣)。我发现
\setbeamerfont{MyMiniSize}{size*={1.00}{1.00}}
\setbeamerfont{MyMiniSize2}{family=\sffamily,series=\mdseries,size={\fontsize{1}{1}}}
\pgfplotsset{every tick label/.append style={font=\usebeamerfont{MyMiniSize}}}
\pgfplotsset{every node near coord/.append style={font=\usebeamerfont{MyMiniSize}}}
应该这样做,但显然没有任何变化。原因可能是什么?
这是我的 MWE(我知道,有太多的坐标不能称之为“最小”,但它应该可以解释为什么需要这么小的字体大小)
\documentclass[xcolor=dvipsnames]{beamer}
\usepackage{etex}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\parindent=0mm
\usepackage{graphicx}
\usepackage{pgfplots}
\usepgfplotslibrary{clickable}
\usetheme{Boadilla}
\usecolortheme[named =Orange]{structure}
\setbeamertemplate{navigation symbols}{}
\newcommand{\changefont}[3]{%
\fontfamily{#1}
\fontseries{#2}
\fontshape{#3}
\selectfont}
\setbeamerfont{MyMiniSize}{
size*={1.00}{1.00}}
\setbeamerfont{MyMiniSize2}{
family=\sffamily,
series=\mdseries,
size={\fontsize{1}{1}}}
\pgfplotsset{
every tick label/.append style={
font=\usebeamerfont{MyMiniSize}}}
\pgfplotsset{
every node near coord/.append style={
font=\usebeamerfont{MyMiniSize}}}
\pgfplotsset{
compat=1.5.1}
\pgfplotsset{
annot/point format={\%.3f}}
\pgfplotsset{
annot/js fillColor={["RGB",0.85,0.85,0.85]}}
\hypersetup{bookmarksopen=false}
\begin{document}
\frame{%
\frametitle{\changefont{phv}{n}{n}Some Title}
\begin{tikzpicture}
\begin{axis}[
xmin = 0,
xmax = 20,
ymin = 0,
ymax = 200,
nodes near coords,
nodes near coords align = horizontal,
point meta = rawx,
xbar,
width = 9cm,
height = 8.5cm,
yticklabels = {A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H,I,J,A,B,C,D,E,F,G,H},
bar width = 1,
ytick = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198},
xmajorgrids,
xtick align = inside,
ytick align = inside,
tick pos = left,
clickable coords]
\addplot[xbar,fill=blue]
coordinates{(1,1)(2,2)(3,3)(4,4)(5,5)(6,6)(7,7)(8,8)(9,9)(10,10)(11,11)(12,12)(13,13)(14,14)(15,15)(16,16)(17,17)(18,18)(19,19)(20,20)(0,21)(0,22)(0,23)(0,24)(0,25)(0,26)(0,27)(0,28)(0,29)(0,30)(0,31)(0,32)(0,33)(0,34)(0,35)(0,36)(0,37)(0,38)(0,39)(0,40)(0,41)(0,42)(0,43)(0,44)(0,45)(0,46)(0,47)(0,48)(0,49)(0,50)(0,51)(0,52)(0,53)(0,54)(0,55)(0,56)(0,57)(0,58)(0,59)(0,50)(0,61)(0,62)(0,63)(0,64)(0,65)(0,66)(0,67)(0,68)(0,69)(0,60)(0,71)(0,72)(0,73)(0,74)(0,75)(0,76)(0,77)(0,78)(0,79)(0,70)(0,81)(0,82)(0,83)(0,84)(0,85)(0,86)(0,87)(0,88)(0,89)(0,80)(0,91)(0,92)(0,93)(0,94)(0,95)(0,96)(0,97)(0,98)(0,99)(0,100)(0,101)(0,102)(0,103)(0,104)(0,105)(0,106)(0,107)(0,108)(0,109)(0,110)(0,111)(0,112)(0,113)(0,114)(0,115)(0,116)(0,117)(0,118)(0,119)(0,120)(0,131)(0,132)(0,133)(0,134)(0,135)(0,136)(0,137)(0,138)(0,139)(0,140)(0,141)(0,142)(0,143)(0,144)(0,145)(0,146)(0,147)(0,148)(0,149)(0,150)(0,151)(0,152)(0,153)(0,154)(0,155)(0,156)(0,157)(0,158)(0,159)(0,160)(0,161)(0,162)(0,163)(0,164)(0,165)(0,166)(0,167)(0,168)(0,169)(0,170)(0,171)(0,172)(0,173)(0,174)(0,175)(0,176)(0,177)(0,178)(0,179)(0,180)(0,181)(0,182)(0,183)(0,184)(0,185)(0,186)(0,187)(0,188)(0,189)(0,190)(0,191)(0,192)(0,193)(0,194)(0,195)(0,196)(0,197)(0,198)};
\end{axis}
\end{tikzpicture}
}
\end{document}
答案1
您的 MWE 远非最小;我用很多更简单的文件。
该.log
文件显示了您需要知道的所有内容:
LaTeX Font Warning: Font shape `T1/cmss/m/n' in size <1> not available (Font) size <5> substituted on input line 74.
编译 MWE 时会出现许多这样的警告。标准字体不适用于这么小的设计尺寸,因此会使用最小的可用字体。
用来fix-cm
告诉 LaTeX 该字体是可扩展的,我们可以看到它运行良好:
\RequirePackage{fix-cm}
\documentclass{beamer}
\setbeamerfont{MyMiniSize}{size*={1.00}{1.00}}
\setbeamerfont{MyMiniSize2}{family=\sffamily,series=\mdseries,size={\fontsize{1}{1}}}
\begin{document}
\begin{frame}[t]{Banana}
{\usebeamerfont{MyMiniSize} Test\par}
{\usebeamerfont{MyMiniSize2} Test2\par}
\end{frame}
\end{document}
话虽如此,但我真的不推荐这样做,因为没人会看到这些数字。观众可能会认为投影仪的镜头上有污渍,或者投影屏幕上有苍蝇,或者诸如此类的东西。它看起来是这样的,用一个正常标题大小的香蕉作为比例:
并且,在整个幻灯片的上下文中: