\hence and \Hence
Alternating hence and therefore
The following code defines two commands,\hence and
\Hence. The former expands alternatingly to
hence and therefore, whereas the latter expands alternatingly to
Hence, we obtain
and Therefore, we obtain.
\ExplSyntaxOn
\bool_new:N \g_hencetherefore
\NewDocumentCommand{\hence}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\str_if_eq:noTF {Hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\bool_gset_false:N \g_hencetherefore
}
}
}
\bool_if:nTF { \g_hencetherefore } {
\bool_gset_false:N \g_hencetherefore
hence
} {
\bool_gset_true:N \g_hencetherefore
therefore
}
\IfValueF{#1}{~}
}
\NewDocumentCommand{\Hence}{ o }{
\IfValueT{#1}{
\str_if_eq:noTF {hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\str_if_eq:noTF {Hence} {#1} {
\bool_gset_true:N \g_hencetherefore
} {
\bool_gset_false:N \g_hencetherefore
}
}
}
\bool_if:nTF { \g_hencetherefore } {
\bool_gset_false:N \g_hencetherefore
Hence,~we~obtain
} {
\bool_gset_true:N \g_hencetherefore
Therefore,~we~obtain
}
\IfValueF{#1}{~}
}
\ExplSyntaxOffhence,
Hence,
therefore, or
Therefore
and forces the command to use the corresponding word. Here is an example that illustrates how these
commands work:
\Hence that $x>0$.
The fact that $y>0$ \hence ensures that $xy>0$.
\Hence[therefore] that $(xy)^2>0$.