arithmetic

tikz:计算坐标的算术
arithmetic

tikz:计算坐标的算术

考虑这个例子: \documentclass[margin=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \def\xstart{-1} % \def\xstart{-0.2-0.8} ...

Admin

使用不同类型的变量进行计算
arithmetic

使用不同类型的变量进行计算

有没有办法计算 tikz 图片中节点的高度,并将一个长度除以另一个长度以获得计数器并将其四舍五入?如果有,在阅读完使用不同类型的变量进行计算的主题后,我可以在哪里阅读? 以下是一个例子: \documentclass [a4paper] {article} \usepackage{calc} \usepackage{tikz,pgf} \usetikzlibary{arrows} %in this case i want to do a framebox with the parameter of 1 line's length in...

Admin

TeX 变量在列表环境中变为本地变量?
arithmetic

TeX 变量在列表环境中变为本地变量?

显然,当 TeX 计数器的值在enumerate环境(以及毫无疑问的许多其他上下文)内被修改时,它就像一个局部变量,因此对它的任何修改都是环境本地的。例如,此代码 \documentclass{article} \newcount\total \total = 5 \begin{document} At first total = \number\total \begin{enumerate} \item \advance \total by 10 Now total = \number\total \item \advance \tot...

Admin

是否可以对表中的条目执行算术运算?
arithmetic

是否可以对表中的条目执行算术运算?

我希望 LaTeX 自动对表格中某一列的条目求和。我知道这些条目始终是整数,但我想不出“获取”它们的值的方法。我的第一个想法是这样的: \documentclass{article} \usepackage{array} \begin{document} \newcount\markcount \markcount=0 \newcount\tmpcount \begin{tabular}{c>{\tmpcount}c<{\advance\markcount by\tmpcount\the\tmpcount}} a & 1 \\ b &am...

Admin

pgfmathsetcounter 不精确
arithmetic

pgfmathsetcounter 不精确

我想使用以下命令 \newcommand{\Gewicht}[2]{ \pgfkeys{/pgf/number format/.cd, precision=8} Volumen des Bauteils nach CAD: \SI{#1}{\cm^3}\\ Dichte: \SI{#2}{\kg\per\cm^3}\\ \pgfmathsetmacro{\Masse}{#1*#2} Gewicht: $\SI{#1}{\cm^3} \cdot \SI{#2}{\kg\per\cm^3}$ = \SI[round-mod...

Admin

如何将跳过长度的所有组成部分乘以相同的数字?
arithmetic

如何将跳过长度的所有组成部分乘以相同的数字?

我正在寻找一种方法,简单地将跳跃表达式中的所有组件(自然长度加上正长度减去负长度)乘以相同的数字。我在下面的 MWE 中尝试了一些示例,但没有成功。当然,我可以创建 3 个不同的 dimen 表达式,然后将每个 dimen 表达式乘以一个数字,然后将每个结果输入到跳跃表达式中,但我正在寻找一种更简单、更方便的解决方案。在我的 MWE 中,\skip_show:N当它不产生错误时仅显示自然长度。 \documentclass{article} \ExplSyntaxOn \skip_const:Nn \c_mymodule_myskipi_skip { 36p...

Admin

具有小参数的 pgfplots 中的 Asinh 尺度
arithmetic

具有小参数的 pgfplots 中的 Asinh 尺度

我最近问过关于在pgfplots。虽然那里给出的解决方案确实实现了 asinh 比例,但当我尝试在我的特定情况下实现它时,我遇到了 TeX 算术功能的问题。这是我尝试制作的图表的 MWE,其中包含一些示例数据: \documentclass[tikz]{standalone} \RequirePackage{pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{groupplots} \begin{filecontents*}{test.csv} omega,fourier,taylor,diffe...

Admin

简化算术 +-, -+, --, 1x, -1x
arithmetic

简化算术 +-, -+, --, 1x, -1x

我制作了一些命令 \pcoef 和 \mcoef,它们分别将算术表达式中的 +- 和 -+ 简化为 -,将 -- 简化为 +,以及将 1x 和 -1x 分别简化为 x 和 -x。它们并不令人满意,因为它们的使用是一种非自然的算术转录。 我想要生成可以以“自然”方式使用的 +、- 和 * 命令。 以下代码包含我所做的命令以及我想要的内容: \documentclass[12pt,a4paper,notitlepage]{extarticle} \usepackage{xfp} %for \fpeval,randint \pagenumbering{gobble...

Admin

如何正确对齐、居中和编号多步骤算术问题?
arithmetic

如何正确对齐、居中和编号多步骤算术问题?

如图所示,我想要几样东西: 编号步骤(如果可能,在左侧) 正确对齐和居中,因此看起来很专业。 步骤#2 中的总和需要与加号正确对齐。 \documentclass{article} \usepackage{dcolumn} \begin{document} \begin{equation} \begin{array}{l@{}l@{}l} 5 & 4 & \rightarrow 50 + 4 \\ \times & 7 \\ \cline{1-2} \end{array}...

Admin

使用 \expr 乘以长度
arithmetic

使用 \expr 乘以长度

我有一个希望缩放的长度,但是我不确定如何进行,并且我在网上找到的答案都没有帮助。 我尝试从中得出这个结论的函数是: % #1 is the unit to convert to % #2 is the length to convert \makeatletter \def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1} \makeatother 进入: % #1 is the length % #2 is the multiple % #3 is the output units...

Admin

计算长度/比例之间的比率
arithmetic

计算长度/比例之间的比率

我想计算两个长度之间的比率,以便使用 mercatormap 包自动获取地图的比例。例如,我希望地图在水平方向上显示 1 公里,并且宽度为\textwidth,这意味着我必须提供的比例参数将是这样的100000cm / \textwidth。 我找到了这个解决方案: \documentclass{minimal} \usepackage{graphicx} \begin{document} \makeatletter \Gscale@div\tmp {100cm}{\textwidth} {\textbackslash}textwidth = \the...

Admin

把这个加法代码变成减法
arithmetic

把这个加法代码变成减法

\documentclass{article} \usepackage{xintexpr}[2018/05/18]% because we use randrange() \newcommand{\BaseTenAddition}{% % temporarily make definitions have global scope, because % xint creation of variable is scope obedient and is lacking % user interface for global scope (should b...

Admin

如何在 tikzpicture 中使用动态数值变量?
arithmetic

如何在 tikzpicture 中使用动态数值变量?

我目前正在创建技术文档,通过 tikzpicture 描述跨 I2C 总线的数据流(类似示例的图形)我最初是手动执行此操作的,结果如下: 如图所示,我的描述使用围绕每个文本元素绘制的线交叉图案。我最终停止手动执行此操作(即此图不完整,如图所示),希望我可以创建一个宏函数来为具有一致间距的任意文本元素列表执行此操作。 我想到了以下(不完整的)示例: \documentclass{article} \usepackage[utf8x]{inputenc} \usepackage{tikz} \usepackage{graphicx,pgf} \usepacka...

Admin