28 Kasım 2009, CUMARTESİ
Lateks İsteğe Bağlı Bağımsız Değişkenleri
Nasıl Lateks isteğe bağlı bağımsız değişkenleri ile bir komut oluşturmak mı? Gibi bir şey
\newcommand{\sec}[2][]{
\section*{#1
\ifsecondargument
and #2
\fi}
}
}
Sonra, öyle diyebilirim
\sec{Hello}
%Output: Hello
\sec{Hello}{Hi}
%Output: Hello and Hi
CEVAP
28 Kasım 2009, CUMARTESİ
Gelen örnek guide:
\newcommand{\example}[2][YYY]{Mandatory arg: #2;
Optional arg: #1.}
This defines \example to be a command with two arguments,
referred to as #1 and #2 in the {<definition>}--nothing new so far.
But by adding a second optional argument to this \newcommand
(the [YYY]) the first argument (#1) of the newly defined
command \example is made optional with its default value being YYY.
Thus the usage of \example is either:
\example{BBB}
which prints:
Mandatory arg: BBB; Optional arg: YYY.
or:
\example[XXX]{AAA}
which prints:
Mandatory arg: AAA; Optional arg: XXX.
Bunu Paylaş:
İsteğe bağlı konumsal bağımsız değişke...
Nasıl isteğe bağlı giriş bağımsız deği...
'' değişkenleri isteğe bağlı...
İsteğe bağlı bağımsız değişkenler ile ...
Nasıl bir işlev çağrısı isteğe bağlı b...