You can use the \IfNoValueTF command or its reverse form ( ltnews32 ) to check whether there is an optional argument or not.
\documentclass{article}
\newcommand{\A}[1][]{%
\IfNoValueTF{#1}
{\ensuremath{A_{ab}}}
{\ensuremath{A_{ab,#1}}}
}
\begin{document}
\verb*|$\A$| $\rightarrow\A$
\verb ...
Search found 369 matches
- Tue Jan 30, 2024 3:36 am
- Forum: Text Formatting
- Topic: Is there a way to get different outputs from \newcommand?
- Replies: 5
- Views: 53694
- Sat Jan 13, 2024 6:28 pm
- Forum: Text Formatting
- Topic: Why won't this run, (new command -> tcolorbox+theorem)
- Replies: 1
- Views: 5928
Why won't this run, (new command -> tcolorbox+theorem)
Please create a complete
minimal working example and mark its code so that it can be tested using the online compiler.
Read in
By the way,
mathtools loads
amsmath.

Read in
\newcommand
and \renewcommand
or an introduction to LaTeX (e.g. learnlatex.org) how to specify the number of arguments when defining a command.By the way,


- Wed Nov 08, 2023 3:17 am
- Forum: Graphics, Figures & Tables
- Topic: [tabularray] Introductory question
- Replies: 3
- Views: 17382
[tabularray] Introductory question
Please post a link to the topic you started elsewhere so that readers of this topic can find out whether you have already received an answer there.
- Tue Oct 24, 2023 3:22 am
- Forum: General
- Topic: Numbering of tcolorbox
- Replies: 4
- Views: 18415
Numbering of tcolorbox
An example based on yours
\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{hyperref}
\usepackage{cleveref}% added
\newtcolorbox[
auto counter,
number within=section,
]{bbb}[2][]{
enhanced,
coltitle=black,
fonttitle=\bfseries,
attach title to upper={\ },
label type ...
\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{hyperref}
\usepackage{cleveref}% added
\newtcolorbox[
auto counter,
number within=section,
]{bbb}[2][]{
enhanced,
coltitle=black,
fonttitle=\bfseries,
attach title to upper={\ },
label type ...
- Mon Oct 23, 2023 5:38 pm
- Forum: General
- Topic: Numbering of tcolorbox
- Replies: 4
- Views: 18415
Numbering of tcolorbox
Please use the tags intended for multiline code. Apart from a more readable highlighting, it can be tested in the same browser tab without having to copy anything first.
It may not solve the problem, but in the package manual the label is set by an option of the same name.
An environment created ...
It may not solve the problem, but in the package manual the label is set by an option of the same name.
An environment created ...
- Tue Oct 17, 2023 5:05 pm
- Forum: Graphics, Figures & Tables
- Topic: [tabularray] Introductory question
- Replies: 3
- Views: 17382
[tabularray] Introductory question
Why don't you show us a
minimal working example with marked code of what you achieved using the
tabularray package manual?
A note: In the first table of section 2.5 "Rows and Columns" you can find out how you can change the height (dimension) of one or more table rows.


A note: In the first table of section 2.5 "Rows and Columns" you can find out how you can change the height (dimension) of one or more table rows.
- Fri Oct 13, 2023 7:12 am
- Forum: Document Classes
- Topic: Passing rgb colour syntax
- Replies: 1
- Views: 18837
Passing rgb colour syntax
You pass the name of a color model as the name of a color. Please read the description of the \color command.
One way to achieve what you want would be
\documentclass[a4paper,12pt]{article}
\usepackage{xcolor}
\ExplSyntaxOn
\NewDocumentEnvironment{that}{O{orange}ommm}
{
#3 #4 #5
\IfValueTF ...
One way to achieve what you want would be
\documentclass[a4paper,12pt]{article}
\usepackage{xcolor}
\ExplSyntaxOn
\NewDocumentEnvironment{that}{O{orange}ommm}
{
#3 #4 #5
\IfValueTF ...
- Wed Jul 05, 2023 5:41 am
- Forum: BibTeX, biblatex and biber
- Topic: Bibliography. New & clueless
- Replies: 2
- Views: 78244
Bibliography. New & clueless
According to the section 3.1.1 "Load-time Options" in the
biblatex manual, the package is set to work with
biber by default. If you don't need to use the
bibtex program run by the editor, then change its setting.



- Mon Jul 03, 2023 11:17 pm
- Forum: Graphics, Figures & Tables
- Topic: Long text inside TABLE
- Replies: 5
- Views: 4348
Long text inside TABLE
I loaded the package to check if the content of the last column extends into the right margin. Remove or comment out the command that reduces the font size in your example and you'll see what I mean.
- Mon Jul 03, 2023 2:03 pm
- Forum: Graphics, Figures & Tables
- Topic: Long text inside TABLE
- Replies: 5
- Views: 4348
Long text inside TABLE
See the description of the showframe package I added to the preamble.kettu_lissa wrote:1) What are those empty rectangles on the right of the table and above it?
Read section 15.1kettu_lissa wrote:2) Is there any practical difference between\\
and\par
?
\par