For math symbols or operators I open create a custom command such as  \newcommand{\prob}[2]{%     \ifthenelse{\isempty{#2}}%     {%         p( #1 )     }{%         p( #1 \mid #2 )%     }% }%   to capture the cases where I want to type a conditional or a un-conditional probability with one command, and to be able to change the notation easily if I find out that it is suboptimal.  Now, I also want to create a list of symbols and index using glossaries where I would use e.g.  \glsxtrnewsymbol[description={Probability density functon}]{prob}{\ensuremath{\prob{\cdot}}}   To get the glossary and index right, I would be obliged to use e.g. \gls{prob} (instead of \prob) also e.g. in an align environment and $$ math, correct? But in this case, I cannot make use of the function \prob that I defined beforehand.  Now the question: Is there an efficient way to deal with this? I.e. to define (complex) functions that capture multiple possible use cases and make use of the glossary?  Naively speaking, it would be perfect to 'overload' the \gls with the options declared for \prob, is that possible?
19278
I am trying to use the approach given in the solution here  (which looks really neat) for an application where i am having more than one glossary; in the original i have only a symbolslist and abbreviations, but here's an mwe adapting the symbolslist to the main list provided in the solution of the link above  \documentclass{scrbook} % \usepackage[acronym,toc]{glossaries} %this line is new \newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols} \makeglossaries \glsnoexpandfields  \newcommand*{\glsarg}{i}  \newglossaryentry{BetragVektor}{      name=\ensuremath{|\overline{u_i}|},      text=|\overline{u_{\glsarg}}|,     description={ABC}} \newglossaryentry{s:tP}{     name=\ensuremath{T_p\mathcal M},     text=T_\glsarg\mathcal M,     description={},     type=symbolslist %in own list } % modify the entry's format  \defglsentryfmt{%   \let\orgglsarg\glsarg   \ifdefempty\glsinsert   {}%   {%     \let\glsarg\glsinsert     \let\glsinsert\relax   }%   \glsgenentryfmt   \let\glsarg\orgglsarg }  \begin{document}  $\gls{BetragVektor}[1]$  $\gls{BetragVektor}$  $\gls{BetragVektor}[1]$  $\gls{BetragVektor}[2]$  $\gls{BetragVektor}[]$  $\gls{s:tP}[1]$  $\gls{s:tP}$  $\gls{s:tP}[1]$  $\gls{s:tP}[2]$  $\gls{s:tP}[]$  \printglossaries \end{document}   As mentioned, the only thing new is that I introduce a second list. The solution still seems to work for the main list as the result shows.    So somehow the new argument gets added in the and and \glsarg stays the same. How can I solve this, such that my new glossary also can have optional parameters on their entries?
76706
I'm drawing a sequence diagram with  and I want to incorporate a greek letter in a message description.  Something like \mess[1]{a}{Message $\alpha$}{b}. While pgf-umlsd seems to allow $ for using the math mode, it apparently does not allow any \ (so I can't write e.g. \alpha).   \protect also doesn't work. Furthermore, I've defined a variable with \def\alph{$\alpha$}, and used it with \mess[1]{a}{Message \alph}{b}, but also to no avail. If the definition is set to \def\alph{$alpha$}, it works fine but of course doesn't produce an alpha. So, \ is apparently not generally prohibited inside pgf-umlsd message descritiptions.  Is there a possibility to somehow use greek letters?  Here is a minimal example of the problem:  \documentclass{article}                                                                                      \usepackage{pgf-umlsd}                                                                                       \begin{document}                                                                                             \begin{figure} [ht!]                                                                                         \def\alph{$\alpha$}                                                                                          \def\bet {$beta$}                                                                                            \begin{sequencediagram}                                                                                          \newthread{a}{Alice}{Alice}                                                                                  \newthread{b}{Bob}{Bob}                                                                                      \mess[1]{a}{Message \alph}{b} %This doesn't compile                                                          \mess[1]{a}{Message \bet} {b} %This compiles but generates no greek letter                               \end{sequencediagram}                                                                                        \end{figure}                                                                                                 \end{document}
38035
Does anyone know a package for ?    Failing that, is anyone interested in writing a command to create one? I'm thinking of something that would have optional and configurable separators above and below (e.g., lines or large quotation marks), and option to float left, right, or center. Ideally the command should print the argument and the pull quote so you do not have to duplicate the text that you want to quote.   To avoid duplicating existing questions, perhaps we should focus on single column documents, so that the pull quote has to be boxed?
58707
In bash manual, Section 6.5 Shell Arithmetic says  &lt;= &gt;= &lt; &gt; comparison == != equality and inequality   &amp;&amp; logical AND || logical OR   Their meanings seem to imply they are used for conditional expressions. But they appear in the section for arithmetic expressions.   So can they be used in conditional expressions?  In Section 6.4, we already have operators for conditional expressions, which are similar to &lt;=,&gt;=,&lt;,&gt;,==,!= for arithmetic expressions:     arg1 OP arg2      OP is one of ‘-eq’, ‘-ne’, ‘-lt’, ‘-le’, ‘-gt’, or ‘-ge’. These   arithmetic binary operators return true if arg1 is equal to, not equal   to, less than, less than or equal to, greater than, or greater than or   equal to arg2, respectively. Arg1 and arg2 may be positive or negative   integers.   We also already have operators for  conditional expressions, which are similar to &amp;&amp; and || for arithmetic expressions:   -a and -o for test i.e. [...] &amp;&amp; and || for [[...]].   Since we have the operators introduced for conditional expressions, why do we need those similar operators introduced for arithmetic expressions? Can they be used in test commands?  We know that if is followed by a test command     The syntax of the if command is:  if test-commands; then consequent-commands; [elif more-test-commands; then more-consequents;] [else alternate-consequents;] fi    [...] and [[...]] both take conditional expressions within and create test commands. Can they take arithmetic expressions?  What makes me even confused is when [...] and [[...]] with arithmetic expressions in them are used as test command, [...] behaves incorrectly, while [[...]] correctly:  $ if [ 1 &gt; 2 ]; then echo h; else echo b; fi h $ if [ 1 &lt; 2 ]; then echo h; else echo b; fi h $ if [[ 1 &lt; 2 ]]; then echo h; else echo b; fi h $ if [[ 1 &gt; 2 ]]; then echo h; else echo b; fi b
2719
I'm reading Papadimitriou &amp; Steiglitz's Combinatorial Optimization and came across notation I'd never seen before and don't know what it means. The $\LaTeX$ markup for it is \gtrless ($\gtrless$), which took me quite a while to find.  It arises in the formulation of general linear programs in terms of the constraints on the variables:  $$ x_j \geq 0 \;\; j \in N\\ x_j \gtrless 0 \;\; j \in \bar{N} $$  It's not "not equals" because there's places in the text where the authors say $x$ can be zero.
96075
Here is a quick question, how to use tex to print this ' symbol? An example is shown below:  data 'a list = Nil | Cons (e, 'a list)   I tried to use ' or `, but they all looks bad.. I am sorry but I am not a native English speaker, so I don't even know the name of '..   Could anyone help me on this simple problem? thank you
26731
I tend to use \newcommand to define macros for symbols I use often, e.g. \newcommand{\hankel}{H^{(1)}_0}.  One inconvenience of this approach is the fact that command names cannot include numbers.  What I ideally want is to map something like \H0 to H^{(1)}_0.  I imagine this could be done with some macro expansion/snippet package, or one might use \newcommand to define a command that takes a parameter, etc.  Before I start experimenting, though -- is there a canonical way of dealing with this problem?
88430
I'm unsure of when it is preferable to use \text versus \mathrm, is there some unwritten rule about the use of these?  For example, I saw the following code in a math post:  \frac{\mathrm{lcm}(m,n)}{\mathrm{gcd}(m,n)}\quad\text{divides}\quad  \frac{\mathrm{lcm}(m,n)}{|\langle x\rangle\cap\langle y\rangle|}\quad \text{divides}\quad \mathrm{ord}(ab)\quad\text{divides}\quad \mathrm{lcm}(m,n).   and there is a mix of both. Is there a general reason why the author would choose to do so?
15675
Is this just a bit of historical cruft left over from the 1950s or is there some reason syntactically why multi-expression bodies of (if) forms require (progn)? Why can't you wrap the multiple expressions in a set of parentheses like with (let):     (if some-cond      ((exp1) (exp2) (exp3)) ; multi exp "then"      (exp4)) ; single exp "else"   It appears it would be trivial to write a macro to test each body to see first if it is a list and then if it is, if its first element is also a list (and thus not a function invocation) and then to wrap its subcomponents inside a (progn) accordingly.
78673
I am looking to make a log-like operator that looks the same as $p \text{-lim}$. The best way so far I found to do this is  \DeclareMathOperator*{\plim}{\text{$p$-lim}}   Question: Is this the best way to do this? It seems like a bit of a hack.  If I remove \text{...} then it doesn't work.  (Also, I know I can use \operatorname* to give a more flexible implementation like  \newcommand{\plog}[1]{\operatorname*{\text{$#1$-lim}}  where now I can change the p to, say, a p+q when needed.)
87666
I want to check whether a color has been previously defined, consider the below code which doesn't execute.  \documentclass{article}  \usepackage{xcolor} \newcommand{\colorprovide}[2]{\ifx\undefined{#1}\colorlet{#1}{#2}\fi}  \begin{document}     %Initial Definition     \colorprovide{mycolor}{red}     \textcolor{mycolor}{Test 1}      %Will overwrite     \colorlet{mycolor}{green}     \textcolor{mycolor}{Test 2}      %Should NOT overwrite as it exists     \colorprovide{mycolor}{red}     \textcolor{mycolor}{Test 3} \end{document}   In other words and analogous to \providecommand{...} not renewing an existing command if it exists, I need a macro which will will NOT redefine a color if the color has already been defined.  The above code throws an error as the logical checking part \ifx\undefined... is incorrect.
14532
I want to define a command that expands to two completely different things depending on whether I supply, or not, an optional argument. For example,  \mycmd{normal}            -&gt;  something(normal) \mycmd[optional]{normal}  -&gt;  anotherthing(normal, optional)   How can I do this?
38738
I am unsatisfied with the way subscript is rendered for the Greek letter \chi. This particular letter is rendered with a small downward offset. I occasionally have to prefix the subscript with \sciptscriptstyle such that, in effect, an expression may look like   \sup{\chi_{\scriptscriptstyle A_n}(x)}[n]   where   \RenewDocumentCommand{\sup}{m O{}}{     \operatorname{sup}\ifstrempty{#2}{}{\limits_{\mathclap{\substack{\expandafter{\scriptscriptstyle{#2}}}}}}         \expandafter{#1}  }   (I admit this snippet is a little messy, especially due to the uncanonical declaration of the optional argument as O{} and testing via \ifstrempty instead of o for the argument type and IfNoValueTF--using the  package. I am not entirely clear yet about what syntax is more straightforward.)  Is there a way to redefine \chi keeping the syntax in line with all semantically equivalent concepts, i.e., letters, but having only \chi's subscript expressions smaller or slightly lower? To clarify, I am thinking of redefining the subscript operator _ for \chi only. But I naively suppose TeX' grammar would not let me do that.  An evident work-around would involve defining a new macro using a different syntax like  \newcommand{\Chi}[1]{\chi_{\scriptscriptstyle{#1}}}   So effectively, what I want is just   \chi_{expr}   where expr is rendered smaller or offset lower than default.
45274
I would like to label an equation with an arbitrary symbol, rather than a number, or letter.  Is this possible?
44031
How to create the following symbol?
50369
I was getting scope errors on a commutative diagram, and adding {} inside the quote marks eliminated the error. Why and under what circumstances are they needed.  This fails:   \ar[d, "\operatorname{g}_{\sigma_\beta}, \beta \prec \Beta_\gamma"]   This works:   \ar[d, "{\operatorname{g}_{\sigma_\beta}, \beta \prec \Beta_\gamma}"]
27405
I would like to be able to add the symbol "lambda-bar" (see below) into an equation. How can I do this?