我想定義一個變數,例如“名稱”,然后在其他宏或文本的其他部分的其他地方重用它。
但以下代碼無法正常作業。
\documentclass[10pt,a4paper]{article}
\newcommand{\name}[1]{#1}
\newcommand{\showname}{\name}
\begin{document}
\name{Kiana}
% My name is ``\showname''
\end{document}
uj5u.com熱心網友回復:
你可以這樣做:
\documentclass[10pt,a4paper]{article}
\newcommand{\name}[1]{\def\showname{#1}}
\begin{document}
\name{Kiana}
My name is ``\showname''
\end{document}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/484419.html
上一篇:運行下載鏈接并解壓縮到python中的檔案夾,其中包含存盤變數的url
下一篇:Stan變數宣告:var_typevar_name[length]和vector[length]var_name的使用區別
