58k views

### Optional argument for newcommand? [duplicate]

Possible Duplicate: Different command definitions with and without optional argument I would like to define a macro which takes an optional argument, and behaves in different ways depending on if ...
670 views

### New command with two definitions [duplicate]

I want to define a new command that serves two slightly different purposes. Can I define a new command called \set such that it's definition is chosen according to the number of argument(s) is(are) ...
158k views

### What do \makeatletter and \makeatother do?

Many LaTeX “hacks” begin with \makeatletter and end with \makeatother. What do these commands do?
1k views

### Conditionally Remove Brackets

I'm trying to create a command with an optional argument using \newcommand{\Af}[1]{{\mathbf{A}_{(#1)}} where the argument is a number. However, I'd like that if no argument is given the bracket ...
4k views

### New command with optional argument being first argument [duplicate]

I know I can create a new command with an optional parameter with \newcommand{\mycommand}[2][Hello]{\textbf{#1} #2} I would like to have the command such that there is an optional parameter which ...
11k views

### Cornell Notes - A lyx or latex solution needed

I teach academic writing to computing students and one of the tasks they have to carry out is to compile a set of research notes which can then be developed into an essay. I find that the Cornell ...
2k views

### Parsing optional macro arguments

I am trying to define a macro with flexible arguments: 3 mandatory and 2 optional ones - like this: \macro{<enter code here>}[arg2] arg3 = arg4 | arg5; So args 2 and 5 are optional, as is the |...
5k views

### \newcommand with options

632 views

### Two independent optional arguments for new commands

I'm trying to adapt the solution provided in Different command definitions with and without optional argument to change the behavior of my new command. I'd like to use basic command to avoid some non ...
976 views

### How can I get curly arrow underneath a state in a state transition diagram

I have a simple state transition diagram that I'd like to render in latex ideally using regular mathmode markup. The arrows show the probability of going between states. \underbrace{\boxed{A}}_{1/4} \...
7k views

### How do I use the etoolbox package to check if an argument to a macro was defined?

I saw this answer, which uses the etoolbox package to create a macro with an optional argument. Unfortunately, I can't get it to work. Here is a minimal working example: \documentclass[12pt]{article} ...
2k views

### How do I put card backs on my cards?

I have a a document that is making me sheets of cards. A stripped down, almost minimal example looks something like \documentclass{article} \usepackage[utf8]{inputenc} %Needed for input \usepackage{...
795 views

### Different macro behavior when supplied an argument

I want to define a macro, call it \func, so that \func will output\phi, and \func[i] will output \phi(i). what is the easiest way to achieve this? I know there are other questions that address this ...