![使用 siunitx 中 \num 内的文本](https://linux22.com/image/276120/%E4%BD%BF%E7%94%A8%20siunitx%20%E4%B8%AD%20%5Cnum%20%E5%86%85%E7%9A%84%E6%96%87%E6%9C%AC.png)
考虑一下这个 TikZ 绘制的元素表(取自这里并做了一些编辑):
\documentclass{article}
\usepackage{verbatim}
\usepackage{ifpdf}
\usepackage{tikz}
\usetikzlibrary{shapes,calc}
\usepackage[
active,
tightpage
]{preview}
\usepackage[
locale=DE,
input-decimal-markers={,}
]{siunitx}
\ifpdf
\else
\usepackage{pst-all}
\fi
\begin{comment}
:Title: Grundstoffernes periodiske system
\end{comment}
\begin{document}
\newcommand{\CommonElementTextFormat}[4]{%
\begin{minipage}{2.2cm}
\centering
{\textbf{#1} \hfill #2}% <----- Here, I would like to change `#2' to `\num{#2}'.
\linebreak \linebreak
{\textbf{#3}}%
\linebreak \linebreak
{{#4}}
\end{minipage}
}
\newcommand{\NaturalElementTextFormat}[4]{%
\CommonElementTextFormat{#1}{#2}{\LARGE {#3}}{#4}
}
\newcommand{\OutlineText}[1]{%
\ifpdf
\pdfliteral direct {0.5 w 1 Tr}{#1}%
\pdfliteral direct {1 w 0 Tr}%
\else
% PSTricks kan gøre dette med \pscharpath.
\pscharpath[
shadow=false,
fillstyle=solid,
fillcolor=white,
linestyle=solid,
linecolor=black,
linewidth=0.2pt
]{#1}
\fi
}
\newcommand{\SyntheticElementTextFormat}[4]{%
\ifpdf
\CommonElementTextFormat{#1}{#2}{\OutlineText{\LARGE #3}}{#4}
\else
% PSTricks giver output, der er en smule større, så vi skal have lavet boksen lidt mindre.
\CommonElementTextFormat{#1}{#2}{\OutlineText{\Large #3}}{#4}
\fi
}
\begin{preview}
\begin{tikzpicture}[font=\sffamily, scale=0.45, transform shape]
% Farveudfyldning af elementpladser.
\tikzstyle{ElementFill} = [fill=yellow!15]
\tikzstyle{AlkaliMetalFill} = [fill=blue!55]
\tikzstyle{AlkalineEarthMetalFill} = [fill=blue!40]
\tikzstyle{TransitionMetalFill} = [fill=blue!25]
\tikzstyle{MetalFill} = [fill=blue!15]
\tikzstyle{MetalloidFill} = [fill=orange!25]
\tikzstyle{NonmetalFill} = [fill=green!25]
\tikzstyle{HalogenFill} = [fill=green!40]
\tikzstyle{NobleGasFill} = [fill=green!55]
\tikzstyle{LanthanideActinideFill} = [fill=purple!25]
% Opsætning af elementpladser.
\tikzstyle{Element} = [draw=black, ElementFill, minimum width=2.75cm, minimum height=2.75cm, node distance=2.75cm]
\tikzstyle{AlkaliMetal} = [Element, AlkaliMetalFill]
\tikzstyle{AlkalineEarthMetal} = [Element, AlkalineEarthMetalFill]
\tikzstyle{TransitionMetal} = [Element, TransitionMetalFill]
\tikzstyle{Metal} = [Element, MetalFill]
\tikzstyle{Metalloid} = [Element, MetalloidFill]
\tikzstyle{Nonmetal} = [Element, NonmetalFill]
\tikzstyle{Halogen} = [Element, HalogenFill]
\tikzstyle{NobleGas} = [Element, NobleGasFill]
\tikzstyle{LanthanideActinide} = [Element, LanthanideActinideFill]
\tikzstyle{PeriodLabel} = [font={\LARGE\sffamily}, node distance=2.0cm]
\tikzstyle{GroupLabel} = [font={\LARGE\sffamily}, minimum width=2.75cm, node distance=2.0cm]
\tikzstyle{TitleLabel} = [font={\Huge\bfseries\sffamily}]
% Gruppe 1 - IA
\node[name=H, Element] {\NaturalElementTextFormat{1}{1,00794}{H}{Hydrogen}};
\node[name=Li, below of=H, AlkaliMetal] {\NaturalElementTextFormat{3}{6,941}{Li}{Litium}};
\node[name=Na, below of=Li, AlkaliMetal] {\NaturalElementTextFormat{11}{22,9897693}{Na}{Natrium}};
\node[name=K, below of=Na, AlkaliMetal] {\NaturalElementTextFormat{19}{39,0983}{K}{Kalium}};
\node[name=Rb, below of=K, AlkaliMetal] {\NaturalElementTextFormat{37}{85,4678}{Rb}{Rubidium}};
\node[name=Cs, below of=Rb, AlkaliMetal] {\NaturalElementTextFormat{55}{132,90545196}{Cs}{C{\ae}sium}};
\node[name=Fr, below of=Cs, AlkaliMetal] {\NaturalElementTextFormat{87}{223,0197}{Fr}{Francium}};
% Gruppe 2 - IIA
\node[name=Be, right of=Li, AlkalineEarthMetal] {\NaturalElementTextFormat{4}{9,0121831}{Be}{Beryllium}};
\node[name=Mg, below of=Be, AlkalineEarthMetal] {\NaturalElementTextFormat{12}{24,3050}{Mg}{Magnesium}};
\node[name=Ca, below of=Mg, AlkalineEarthMetal] {\NaturalElementTextFormat{20}{40,078}{Ca}{Calcium}};
\node[name=Sr, below of=Ca, AlkalineEarthMetal] {\NaturalElementTextFormat{38}{87,62}{Sr}{Strontium}};
\node[name=Ba, below of=Sr, AlkalineEarthMetal] {\NaturalElementTextFormat{56}{137,327}{Ba}{Barium}};
\node[name=Ra, below of=Ba, AlkalineEarthMetal] {\NaturalElementTextFormat{88}{226,0254}{Ra}{Radium}};
% Gruppe 3 - IIIB
\node[name=Sc, right of=Ca, TransitionMetal] {\NaturalElementTextFormat{21}{44,955908}{Sc}{Scandium}};
\node[name=Y, below of=Sc, TransitionMetal] {\NaturalElementTextFormat{39}{88,90584}{Y}{Yttrium}};
\node[name=LaLu, below of=Y, LanthanideActinide] {\NaturalElementTextFormat{57--71}{}{La--Lu}{Lanthanider}};
\node[name=AcLr, below of=LaLu, LanthanideActinide] {\NaturalElementTextFormat{89--103}{}{Ac--\OutlineText{\kern -6pt Lr}}{Actinider}};
% Gruppe 4 - IVB
\node[name=Ti, right of=Sc, TransitionMetal] {\NaturalElementTextFormat{22}{47,867}{Ti}{Titanium}};
\node[name=Zr, below of=Ti, TransitionMetal] {\NaturalElementTextFormat{40}{91,224}{Zr}{Zirkonium}};
\node[name=Hf, below of=Zr, TransitionMetal] {\NaturalElementTextFormat{72}{178,49}{Hf}{Hafnium}};
\node[name=Rf, below of=Hf, TransitionMetal] {\SyntheticElementTextFormat{104}{261,1088}{Rf}{Rutherfordium}};
% Gruppe 5 - VB
\node[name=V, right of=Ti, TransitionMetal] {\NaturalElementTextFormat{23}{50,9415}{V}{Vanadium}};
\node[name=Nb, below of=V, TransitionMetal] {\NaturalElementTextFormat{41}{92,90637}{Nb}{Niobium}};
\node[name=Ta, below of=Nb, TransitionMetal] {\NaturalElementTextFormat{73}{180,94788}{Ta}{Tantal}};
\node[name=Db, below of=Ta, TransitionMetal] {\SyntheticElementTextFormat{105}{262,1141}{Db}{Dubnium}};
% Gruppe 6 - VIB
\node[name=Cr, right of=V, TransitionMetal] {\NaturalElementTextFormat{24}{51,9961}{Cr}{Krom}};
\node[name=Mo, below of=Cr, TransitionMetal] {\NaturalElementTextFormat{42}{95,95}{Mo}{Molybd{\ae}n}};
\node[name=W, below of=Mo, TransitionMetal] {\NaturalElementTextFormat{74}{183,84}{W}{Wolfram}};
\node[name=Sg, below of=W, TransitionMetal] {\SyntheticElementTextFormat{106}{266,1219}{Sg}{Seaborgium}};
% Gruppe 7 - VIIB
\node[name=Mn, right of=Cr, TransitionMetal] {\NaturalElementTextFormat{25}{54,938044}{Mn}{Mangan}};
\node[name=Tc, below of=Mn, TransitionMetal] {\NaturalElementTextFormat{43}{97,9072}{Tc}{Technetium}};
\node[name=Re, below of=Tc, TransitionMetal] {\NaturalElementTextFormat{75}{186,207}{Re}{Rhenium}};
\node[name=Bh, below of=Re, TransitionMetal] {\SyntheticElementTextFormat{107}{264,12}{Bh}{Bohrium}};
% Gruppe 8 - VIIIB
\node[name=Fe, right of=Mn, TransitionMetal] {\NaturalElementTextFormat{26}{55,845}{Fe}{Jern}};
\node[name=Ru, below of=Fe, TransitionMetal] {\NaturalElementTextFormat{44}{101,07}{Ru}{Ruthenium}};
\node[name=Os, below of=Ru, TransitionMetal] {\NaturalElementTextFormat{76}{190,23}{Os}{Osmium}};
\node[name=Hs, below of=Os, TransitionMetal] {\SyntheticElementTextFormat{108}{277}{Hs}{Hassium}};
% Gruppe 9 - VIIIB
\node[name=Co, right of=Fe, TransitionMetal] {\NaturalElementTextFormat{27}{58,933194}{Co}{Kobolt}};
\node[name=Rh, below of=Co, TransitionMetal] {\NaturalElementTextFormat{45}{102,90550}{Rh}{Rhodium}};
\node[name=Ir, below of=Rh, TransitionMetal] {\NaturalElementTextFormat{77}{192,217}{Ir}{Iridium}};
\node[name=Mt, below of=Ir, TransitionMetal] {\SyntheticElementTextFormat{109}{268,1388}{Mt}{Meitnerium}};
% Gruppe 10 - VIIIB
\node[name=Ni, right of=Co, TransitionMetal] {\NaturalElementTextFormat{28}{58,6934}{Ni}{Nikkel}};
\node[name=Pd, below of=Ni, TransitionMetal] {\NaturalElementTextFormat{46}{106,42}{Pd}{Palladium}};
\node[name=Pt, below of=Pd, TransitionMetal] {\NaturalElementTextFormat{78}{195,084}{Pt}{Platin}};
\node[name=Ds, below of=Pt, TransitionMetal] {\SyntheticElementTextFormat{110}{271}{Ds}{Darmstadtium}};
% Gruppe 11 - IB
\node[name=Cu, right of=Ni, TransitionMetal] {\NaturalElementTextFormat{29}{63,546}{Cu}{Kobber}};
\node[name=Ag, below of=Cu, TransitionMetal] {\NaturalElementTextFormat{47}{107,8682}{Ag}{S{\o}lv}};
\node[name=Au, below of=Ag, TransitionMetal] {\NaturalElementTextFormat{79}{196,966569}{Au}{Guld}};
\node[name=Rg, below of=Au, TransitionMetal] {\SyntheticElementTextFormat{111}{272,1535}{Rg}{R{\o}ntgenium}};
% Gruppe 12 - IIB
\node[name=Zn, right of=Cu, TransitionMetal] {\NaturalElementTextFormat{30}{65,38}{Zn}{Zink}};
\node[name=Cd, below of=Zn, TransitionMetal] {\NaturalElementTextFormat{48}{112,414}{Cd}{Cadmium}};
\node[name=Hg, below of=Cd, TransitionMetal] {\NaturalElementTextFormat{80}{200,59}{Hg}{Kviks{\o}lv}};
\node[name=Uub, below of=Hg, TransitionMetal] {\SyntheticElementTextFormat{112}{285}{Cn}{Kopernikium}};
% Gruppe 13 - IIIA
\node[name=Ga, right of=Zn, Metal] {\NaturalElementTextFormat{31}{69,723}{Ga}{Gallium}};
\node[name=Al, above of=Ga, Metal] {\NaturalElementTextFormat{13}{26,9815385}{Al}{Aluminium}};
\node[name=B, above of=Al, Metalloid] {\NaturalElementTextFormat{5}{10,811}{B}{Bor}};
\node[name=In, below of=Ga, Metal] {\NaturalElementTextFormat{49}{114,818}{In}{Indium}};
\node[name=Tl, below of=In, Metal] {\NaturalElementTextFormat{81}{204,3833}{Tl}{Tallium}};
\node[name=Uut, below of=Tl, Metal] {\SyntheticElementTextFormat{113}{286}{Uut}{Ununtrium}};
% Gruppe 14 - IVA
\node[name=C, right of=B, Nonmetal] {\NaturalElementTextFormat{6}{12,0107}{C}{Carbon}};
\node[name=Si, below of=C, Metalloid] {\NaturalElementTextFormat{14}{28,0855}{Si}{Silicium}};
\node[name=Ge, below of=Si, Metalloid] {\NaturalElementTextFormat{32}{72,64}{Ge}{Germanium}};
\node[name=Sn, below of=Ge, Metal] {\NaturalElementTextFormat{50}{118,710}{Sn}{Tin}};
\node[name=Pb, below of=Sn, Metal] {\NaturalElementTextFormat{82}{207,2}{Pb}{Bly}};
\node[name=Uuq, below of=Pb, Metal] {\SyntheticElementTextFormat{114}{289}{Uuq}{Ununquadium}};
% Gruppe 15 - VA
\node[name=N, right of=C, Nonmetal] {\NaturalElementTextFormat{7}{14,0067}{N}{Nitrogen}};
\node[name=P, below of=N, Nonmetal] {\NaturalElementTextFormat{15}{30,973761998}{P}{Fosfor}};
\node[name=As, below of=P, Metalloid] {\NaturalElementTextFormat{33}{74,921595}{As}{Arsen}};
\node[name=Sb, below of=As, Metalloid] {\NaturalElementTextFormat{51}{121,760}{Sb}{Antimon}};
\node[name=Bi, below of=Sb, Metal] {\NaturalElementTextFormat{83}{208,98040}{Bi}{Bismuth}};
\node[name=Uup, below of=Bi, Metal] {\SyntheticElementTextFormat{115}{288}{Uup}{Ununpentium}};
% Gruppe 16 - VIA
\node[name=O, right of=N, Nonmetal] {\NaturalElementTextFormat{8}{15,9994}{O}{Oxygen}};
\node[name=S, below of=O, Nonmetal] {\NaturalElementTextFormat{16}{32,065}{S}{Svovl}};
\node[name=Se, below of=S, Nonmetal] {\NaturalElementTextFormat{34}{78,971}{Se}{Selen}};
\node[name=Te, below of=Se, Metalloid] {\NaturalElementTextFormat{52}{127,60}{Te}{Tellur}};
\node[name=Po, below of=Te, Metalloid] {\NaturalElementTextFormat{84}{208,9824}{Po}{Polonium}};
\node[name=Uuh, below of=Po, Metal] {\SyntheticElementTextFormat{116}{289}{Uuh}{Ununhexium}};
% Gruppe 17 - VIIA
\node[name=F, right of=O, Halogen] {\NaturalElementTextFormat{9}{18,998403163}{F}{Flour}};
\node[name=Cl, below of=F, Halogen] {\NaturalElementTextFormat{17}{35,453}{Cl}{Klor}};
\node[name=Br, below of=Cl, Halogen] {\NaturalElementTextFormat{35}{79,904}{Br}{Brom}};
\node[name=I, below of=Br, Halogen] {\NaturalElementTextFormat{53}{126,90447}{I}{Jod}};
\node[name=At, below of=I, Halogen] {\NaturalElementTextFormat{85}{209,9871}{At}{Astat}};
\node[name=Uus, below of=At, Element] {\SyntheticElementTextFormat{117}{292}{Uus}{Ununseptium}};
% Gruppe 18 - VIIIA
\node[name=Ne, right of=F, NobleGas] {\NaturalElementTextFormat{10}{20,1797}{Ne}{Neon}};
\node[name=He, above of=Ne, NobleGas] {\NaturalElementTextFormat{2}{4,002602}{He}{Helium}};
\node[name=Ar, below of=Ne, NobleGas] {\NaturalElementTextFormat{18}{39,948}{Ar}{Argon}};
\node[name=Kr, below of=Ar, NobleGas] {\NaturalElementTextFormat{36}{83,798}{Kr}{Krypton}};
\node[name=Xe, below of=Kr, NobleGas] {\NaturalElementTextFormat{54}{131,293}{Xe}{Xenon}};
\node[name=Rn, below of=Xe, NobleGas] {\NaturalElementTextFormat{86}{222,0176}{Rn}{Radon}};
\node[name=Uuo, below of=Rn, NobleGas] {\SyntheticElementTextFormat{118}{293}{Uuo}{Ununoctium}};
% Perioder.
\node[name=Period1, left of=H, PeriodLabel] {1};
\node[name=Period2, left of=Li, PeriodLabel] {2};
\node[name=Period3, left of=Na, PeriodLabel] {3};
\node[name=Period4, left of=K, PeriodLabel] {4};
\node[name=Period5, left of=Rb, PeriodLabel] {5};
\node[name=Period6, left of=Cs, PeriodLabel] {6};
\node[name=Period7, left of=Fr, PeriodLabel] {7};
% Grupper.
\node[name=Group1, above of=H, GroupLabel] {1 \hfill IA};
\node[name=Group2, above of=Be, GroupLabel] {2 \hfill IIA};
\node[name=Group3, above of=Sc, GroupLabel] {3 \hfill IIIB};
\node[name=Group4, above of=Ti, GroupLabel] {4 \hfill IVB};
\node[name=Group5, above of=V, GroupLabel] {5 \hfill VB};
\node[name=Group6, above of=Cr, GroupLabel] {6 \hfill VIB};
\node[name=Group7, above of=Mn, GroupLabel] {7 \hfill VIIB};
\node[name=Group8, above of=Fe, GroupLabel] {8 \hfill VIIIB};
\node[name=Group9, above of=Co, GroupLabel] {9 \hfill VIIIB};
\node[name=Group10, above of=Ni, GroupLabel] {10 \hfill VIIIB};
\node[name=Group11, above of=Cu, GroupLabel] {11 \hfill IB};
\node[name=Group12, above of=Zn, GroupLabel] {12 \hfill IIB};
\node[name=Group13, above of=B, GroupLabel] {13 \hfill IIIA};
\node[name=Group14, above of=C, GroupLabel] {14 \hfill IVA};
\node[name=Group15, above of=N, GroupLabel] {15 \hfill VA};
\node[name=Group16, above of=O, GroupLabel] {16 \hfill VIA};
\node[name=Group17, above of=F, GroupLabel] {17 \hfill VIIA};
\node[name=Group18, above of=He, GroupLabel] {18 \hfill VIIIA};
% lanthanider.
\node[name=La, below of=Rf, LanthanideActinide, yshift=-1cm] {\NaturalElementTextFormat{57}{138,90547}{La}{Lanthan}};
\node[name=Ce, right of=La, LanthanideActinide] {\NaturalElementTextFormat{58}{140,116}{Ce}{Cerium}};
\node[name=Pr, right of=Ce, LanthanideActinide] {\NaturalElementTextFormat{59}{140,90766}{Pr}{Praseodym}};
\node[name=Nd, right of=Pr, LanthanideActinide] {\NaturalElementTextFormat{60}{144,242}{Nd}{Neodym}};
\node[name=Pm, right of=Nd, LanthanideActinide] {\NaturalElementTextFormat{61}{144,9127}{Pm}{Promethium}};
\node[name=Sm, right of=Pm, LanthanideActinide] {\NaturalElementTextFormat{62}{150,36}{Sm}{Samarium}};
\node[name=Eu, right of=Sm, LanthanideActinide] {\NaturalElementTextFormat{63}{151,964}{Eu}{Europium}};
\node[name=Gd, right of=Eu, LanthanideActinide] {\NaturalElementTextFormat{64}{157,25}{Gd}{Gadolinium}};
\node[name=Tb, right of=Gd, LanthanideActinide] {\NaturalElementTextFormat{65}{158,92535}{Tb}{Terbium}};
\node[name=Dy, right of=Tb, LanthanideActinide] {\NaturalElementTextFormat{66}{162,500}{Dy}{Dysprosium}};
\node[name=Ho, right of=Dy, LanthanideActinide] {\NaturalElementTextFormat{67}{164,93033}{Ho}{Holmium}};
\node[name=Er, right of=Ho, LanthanideActinide] {\NaturalElementTextFormat{68}{167,259}{Er}{Erbium}};
\node[name=Tm, right of=Er, LanthanideActinide] {\NaturalElementTextFormat{69}{168,93422}{Tm}{Thulium}};
\node[name=Yb, right of=Tm, LanthanideActinide] {\NaturalElementTextFormat{70}{173,054}{Yb}{Ytterbium}};
\node[name=Lu, right of=Yb, LanthanideActinide] {\NaturalElementTextFormat{71}{174,9668}{Lu}{Lutetium}};
% actinider.
\node[name=Ac, below of=La, LanthanideActinide, yshift=-1cm] {\NaturalElementTextFormat{89}{227,0277}{Ac}{Actinium}};
\node[name=Th, right of=Ac, LanthanideActinide] {\NaturalElementTextFormat{90}{232,0377}{Th}{Thorium}};
\node[name=Pa, right of=Th, LanthanideActinide] {\NaturalElementTextFormat{91}{231,03588}{Pa}{Protactinium}};
\node[name=U , right of=Pa, LanthanideActinide] {\NaturalElementTextFormat{92}{238,02891}{U}{Uran}};
\node[name=Np, right of=U, LanthanideActinide] {\SyntheticElementTextFormat{93}{237,0482}{Np}{Neptunium}};
\node[name=Pu, right of=Np, LanthanideActinide] {\SyntheticElementTextFormat{94}{244,0642}{Pu}{Plutonium}};
\node[name=Am, right of=Pu, LanthanideActinide] {\SyntheticElementTextFormat{95}{243,0614}{Am}{Americium}};
\node[name=Cm, right of=Am, LanthanideActinide] {\SyntheticElementTextFormat{96}{247,0704}{Cm}{Curium}};
\node[name=Bk, right of=Cm, LanthanideActinide] {\SyntheticElementTextFormat{97}{247,0703}{Bk}{Berkelium}};
\node[name=Cf, right of=Bk, LanthanideActinide] {\SyntheticElementTextFormat{98}{251,0796}{Cf}{Californium}};
\node[name=Es, right of=Cf, LanthanideActinide] {\SyntheticElementTextFormat{99}{252,0830}{Es}{Einsteinium}};
\node[name=Fm, right of=Es, LanthanideActinide] {\SyntheticElementTextFormat{100}{257,0951}{Fm}{Fermium}};
\node[name=Md, right of=Fm, LanthanideActinide] {\SyntheticElementTextFormat{101}{258,0984}{Md}{Mendelevium}};
\node[name=No, right of=Md, LanthanideActinide] {\SyntheticElementTextFormat{102}{259,1010}{No}{Nobelium}};
\node[name=Lr, right of=No, LanthanideActinide] {\SyntheticElementTextFormat{103}{262,1097}{Lr}{Lawrencium}};
% Prikkede linjer, der forbinder lanthaniderne med hovedtabellen.
\draw (LaLu.north west) edge[dotted] (La.north west)
(LaLu.north east) edge[dotted] (Lu.north east)
(LaLu.south west) edge[dotted] (La.south west)
(LaLu.south east) edge[dotted] (Lu.south east);
% Prikkede linjer, der forbinder actiniderne med hovedtabellen.
\draw (AcLr.north west) edge[dotted] (Ac.north west)
(AcLr.north east) edge[dotted] (Lr.north east)
(AcLr.south west) edge[dotted] (Ac.south west)
(AcLr.south east) edge[dotted] (Lr.south east);
% Placering af figurforklaringer.
\draw[black, AlkaliMetalFill] ($(La.north -| Fr.west) + (1em,1.3em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Alkalimetal};
\draw[black, AlkalineEarthMetalFill] ($(La.north -| Fr.west) + (1em,-0.2em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Jordalkalimetal};
\draw[black, TransitionMetalFill] ($(La.north -| Fr.west) + (1em,-1.7em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Overgangsmetal};
\draw[black, MetalFill] ($(La.north -| Fr.west) + (1em,-3.2em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Metal};
\draw[black, MetalloidFill] ($(La.north -| Fr.west) + (1em,-4.7em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Halvmetal};
\draw[black, NonmetalFill] ($(La.north -| Fr.west) + (1em,-6.2em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Ikke-metal};
\draw[black, HalogenFill] ($(La.north -| Fr.west) + (1em,-7.7em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Halogen};
\draw[black, NobleGasFill] ($(La.north -| Fr.west) + (1em,-9.2em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{{\AE}delgas};
\draw[black, LanthanideActinideFill] ($(La.north -| Fr.west) + (1em,-10.7em)$)
rectangle +(1em, 1em) node[right, yshift=-1ex]{Lanthanoid/Actinid};
\node at ($(La.north -| Fr.west) + (5em,-15em)$) [name=elementLegend, Element, fill=white]
{\NaturalElementTextFormat{Z}{Masse}{Symbol}{Navn}};
\node[Element, fill=white, right of=elementLegend, xshift=1em]
{\SyntheticElementTextFormat{}{}{men\-nes\-ke\-skabt}{}} ;
% Diagramtitel.
\node at (H.west -| Fe.north) [name=diagramTitle, TitleLabel]
%{Dmitri I. Mendeleevs periodiske system for grundstofferne};
{Grundstoffernes periodiske system};
\end{tikzpicture}
\end{preview}
\end{document}
我想将第 30 行从
{\textbf{#1} \hfill #2}
到
{\textbf{#1} \hfill \num{#2}}
以便获得原子质量的良好格式,但我无法将文本放入其中\num
。我该如何解决这个问题?
PS 问题出现在第 321 行。
答案1
您在这里能得到的最接近的方法是定义一个“符号”用于输入,该符号会扩展到您的文本。我会使用\NewDocumentCommand
它,siunitx
否则会尝试扩展内容。精简到基本内容您需要使用来注册它siunitx
,并且我还要确保打印始终处于文本模式:
\documentclass{article}
\usepackage{siunitx}
\NewDocumentCommand{\Masse}{}{\text{Masse}}
\sisetup{input-symbols = \Masse}
\begin{document}
\num{1.23456}
\num{\Masse}
\end{document}