Latex command with line break
command, latex
Solution
Command definitions can be nested; double the `#` for each level.
\newcommand\newchar[2]{%
\newcommand #1 [1] {%
\raggedright #2: \\ \hspace{0.5in} ##1%
}%
}
Update: Just a comment about the `#` doubling. This makes more sense when you're defining macros using the `\def` primitive; in this case, the general construction is something like
\def\foo{%
\def\bar##1{bar: ##1}%
}
Problem
I am trying to create a command in latex that, when invoked such as `\test{\ab}{TEST}`, will create a new command defined as `\ab[1]{\raggedright TEST: \\ \hspace{0.5in} #1}`. What I am trying to do is something along these lines: ``` \newchar{\ab}{TEST} \ab{This is a line TEST says.} ``` That would execute to yield ``` TEST: This is a line TEST says. ``` Failing that (which I do hope is possible), I could settle with another command I have drafted. But the issue there is I need a way to place and newline after the text without the user having to specify it. Thanks ahead for all the help!