如何控制乳胶中pgf/tikz图形的字体大小?

发布于 2024-08-21 04:00:20 字数 567 浏览 3 评论 0原文

我正在 pgf/tikz 中创建图表。当我在文档中使用它们时,它们会被缩放,其中一些位于类似 minipage/subfig 的环境中。发生这种情况时,字体大小会随着图形而缩放,从而使它们非常小或难以阅读。我已经阅读了该手册,但到目前为止,我试图控制它尚未成功。

有没有办法直接设置字体大小?有哪些选择?

下面给出的一个问题展示了如何使用 \tikzstyle 字体选项来指定 tikzpicture 环境中的字体大小。

现在我正在使用:

\beginppgfgraphicnamed{graph}
\input{graph.tex}
\endpgfgraphicnamed

输入文件中使用 tikzpicture 环境。无论如何,我正在使用的设置中可以指定字体大小吗?也许这就是问题所在? graph.tex 文件是通过另一个程序自动生成的。

除了为单个图形设置字体大小之外,最好有一个参数来全局设置所有 tikz 图形的字体大小? 我猜问题是 minipage 中的缩放或子图

非常感谢,

杰伊

I'm creating graphs in pgf/tikz. When I use these in my document they are scaled, several are in minipage/subfig like environments. When this happens the font sizes are scaled with the graphics making them very small or unreadable. I've been through the manual but have so far been unsuccessful in my attempts to control this.

Is there a way to set the font size directly? What options are there?

One aswer given below shows how to how to use the \tikzstyle font option to specify the font size within the tikzpicture environment.

Right now I am using:

\beginppgfgraphicnamed{graph}
\input{graph.tex}
\endpgfgraphicnamed

The tikzpicture environment is used in the input file. Are there anyways to specify font size in the setup I'm using? Is this perhaps the issue? The graph.tex file is generated automatically via another program.

In addition to setting font size for individual graphics it would be ideal to have a parameter to globally set font size for all tikz graphics? I guess the issue is the scaling in minipage or subfig.

Many thanks,

Jay

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

蹲在坟头点根烟 2024-08-28 04:00:20
\begin{tikzpicture}

    \tikzstyle{every node}=[font=\small]

\end{tikzpicture}

将为您提供每个节点上的字体大小控制。

\begin{tikzpicture}

    \tikzstyle{every node}=[font=\small]

\end{tikzpicture}

will give you font size control on every node.

帅气称霸 2024-08-28 04:00:20

我发现更好的控制是使用scalefnt包:

\usepackage{scalefnt}
...
{\scalefont{0.5}
\begin{tikzpicture}
...
\end{tikzpicture}
}

I found the better control would be using scalefnt package:

\usepackage{scalefnt}
...
{\scalefont{0.5}
\begin{tikzpicture}
...
\end{tikzpicture}
}
愿得七秒忆 2024-08-28 04:00:20

我相信米卡的方式值得回答,因为作为评论不够明显:

\begin{tikzpicture}[font=\small]

I believe Mica's way deserves the rank of answer, since is not visible enough as a comment:

\begin{tikzpicture}[font=\small]
橘寄 2024-08-28 04:00:20
\begin{tikzpicture}
    \tikzstyle{every node}=[font=\fontsize{30}{30}\selectfont]
\end{tikzpicture}
\begin{tikzpicture}
    \tikzstyle{every node}=[font=\fontsize{30}{30}\selectfont]
\end{tikzpicture}
甜警司 2024-08-28 04:00:20

您还可以使用:

\usepackage{anyfontsize}

anyfontsize 软件包的巨大优势scalefnt 的优点是不需要将整个 {tikzpicture} 包含在 \scalefont 环境中。

只需将 \usepackage{anyfontsize} 添加到序言中即可实现字体缩放魔法。

You can also use:

\usepackage{anyfontsize}

The huge advantage of the anyfontsize package over scalefnt is that one does not need to enclose the entire {tikzpicture} within a \scalefont environment.

Just adding \usepackage{anyfontsize} to the preamble is all that is required for the font scaling magic to happen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文