我找到了(法语版https://fr.wikibooks.org/wiki/LaTeX/%C3%89crire_de_la_physique#Extension_siunitx)我可以使用该包siunitx
来编写该单元,但它不起作用:
要测试的最小代码:
\documentclass[a4paper]{article}
\usepackage{siunitx}
\title{Test}
\author{Cécile Moulin}
\date{}
\begin{document}
\maketitle
\tableofcontents
text text text
\metre
\end{document}
错误 :
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/siunitx/siunitx.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3pdfmode.def))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/tools/array.sty)
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty)
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/translator.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/translator-language-
mappings.tex))) (./test.aux)
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-bas
ic-dictionary/translator-basic-dictionary-English.dict)
(/usr/share/texlive/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg)
(./test.toc)
! Undefined control sequence.
\metre ->\ERROR
l.18 \metre
我也尝试过有/无 \( \)
和有\meter
,都是一样的
答案1
通常这些单元仅在\si{...}
(和类似的命令)内工作,但如果您想在普通文本中使用它们,您可以使用包free-standing-units=true
的siunitx
。
\documentclass{article}
\usepackage[free-standing-units=true]{siunitx}
\begin{document}
\si{\metre} % for the unit alone
\SI{42}{\metre} % for value and unit
\metre % this needs free-standing-units=true
\SI{10}{\nano\meter}
\SI{10}{\nm}
\SI{10}{nm}
\end{document}