
我正在寫一篇文章,一切都很順利,突然我得到了一個錯誤:
錯誤:
算術溢出。 \calc@帳戶
l.78 ...qwe dqweqwrwf qewrfrQ aRF EFCas drfFR}{62}
我的文章看起來像這樣:
\documentclass [a4paper] {article}
\usepackage [magyar]{babel}
\usepackage {t1enc}
\usepackage [utf8]{inputenc}
\usepackage {calc}
\usepackage{ifthen}
\usepackage {tikz}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usepackage[nomessages]{fp}
\usepackage{xparse}
\title{teszt}
\newcommand*{\getlength}[2]{%
% Convert to `cm` and round to two fractional digits:
\pgfmathsetmacro#1{round(3.51459804*#2)/100.0}%
}
\newcommand {\barany}[2] {
%
\newlength{\myoszzhosz}
\newlength{\oszsormag}
\newlength{\osszsormag}
\newcount{\szeles}
\newlength{\sormag}
\szeles=#2
\the\szeles
\settowidth{\sormag}{drfesga}
%
%
\settowidth{\myoszzhosz}{#1}
\getlength{\valueoszhosz}{\myoszzhosz}
\getlength{\valuesormag}{\sormag}
\setlength{\oszsormag}{\myoszzhosz/\szeles}
\setlength{\osszsormag}{\oszsormag*\sormag}
%
\begin{tikzpicture}[scale=0.5,>=stealth]
\draw [shift={(0,1)}][domain=270:90] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(2,1)}][domain=0:180] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(4,1)}][domain=360:180] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(6,1)}][domain=270:450] plot ({cos(\x)}, {sin(\x)});
\node[\textwidth=#2pt] at (2,0) {#1};
\end{tikzpicture}
}
\begin{document}
\barany{ptn kthkthkt hkthkthk thktfa dsgrf gadf gagag fagaga gadfgfdag fdaarfgg adasad
fggdfgrgdhfb brhgfhb}{62}
\end{document}
你能幫我一下嗎?
答案1
除了\textwidth
需要text width
生成錯誤的程式碼之外,似乎沒有任何用途,所以我只是將其刪除。我還刪除了範例中未使用的所有套件。
\documentclass [a4paper] {article}
\usepackage {tikz}
\title{teszt}
\newcommand {\barany}[2]{%
%
\begin{tikzpicture}[scale=0.5,>=stealth]
\draw [shift={(0,1)}][domain=270:90] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(2,1)}][domain=0:180] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(4,1)}][domain=360:180] plot ({cos(\x)}, {sin(\x)});
\draw [shift={(6,1)}][domain=270:450] plot ({cos(\x)}, {sin(\x)});
\node[text width=#2pt] at (2,0) {#1};
\end{tikzpicture}%
}
\begin{document}
\barany{ptn kthkthkt hkthkthk thktfa dsgrf gadf gagag fagaga gadfgfdag fdaarfgg adasad
fggdfgrgdhfb brhgfhb}{62}
\end{document}
這運行沒有錯誤並產生
我認為這不是您想要的輸出,但我無法從給出的描述中猜測您想要的輸出。
如果您對如何使用 tikz 繪製某些內容有一個具體問題,最好專注於一個特定方面並在新問題中詢問該問題,而不是發布帶有語法錯誤的大量代碼並只詢問如何避免該錯誤,只能透過修復語法問題來真正回答,而不是產生任何合理的輸出。