1
vote
0answers
39 views

Texmaker. Color in the editor. Math mode

I am starting to use Texmaker with the default configuration. When I use the math mode ($...$) all of it is coloured in green in the editor, making long formulas difficult to follow. I would like ...
7
votes
5answers
106 views

Preventing math mode from parsing macro input as math?

Basic Problem I'm trying to produce a command sequence \m that Is called from within math mode, with a single argument list "Replaces" all instances , and ; in list with & and \\ (resp.) ...
3
votes
1answer
40 views

Change \newcommand behaviour based on the environment

I'd like to define a command \Lm, such that if used in a maths environment it is replaced with \mathcal{L}, but when used outside of the maths environment it would be replaced with $\mathcal{L}$. This ...
1
vote
2answers
63 views

newcommand for $\frac{\mathrm{d}^4q}{\left(2\pi\right)^4}$

Can you give any hints on how to define a new command that writes $\frac{\mathrm{d}^4q}{\left(2\pi\right)^4}$ with the options that one can write $p$ instead of $q$ (say) and also if one could ...
7
votes
2answers
65 views

Setting an “attribute” for Theorem to be accessed later

I am writing a math paper with a large number of theorems. I'm looking to have a table summarizing my results, and I'd love it if the table could be generated automatically from my paper. I' looking ...
5
votes
2answers
69 views

Double subscript error with \newcommand?

Disclaimer: I know of Defining a newcommand with sub- or superscript and avoiding "double subscript" error but this only gives a work-around, but no explanation to my question. Here's a ...
4
votes
1answer
91 views

Create “bracket free” macros (like in mimeTeX)

In mimeTeX, an abundance of macros like \cd = \cdot, \fr = \frac and \sq = \sqrt are allowed. This kind of macros are easily created in own LaTeX documentens, using \newcommand. Other mimeTeX macros ...
5
votes
1answer
61 views

How to build a conditional based on a resize paramater

I would like to define my own macro that accepts an optional parameter such as \big, \Big, etc that apply that if it is specified, otherwise apply the auto resizing \left, \right pair. So, how do I ...
3
votes
2answers
164 views

Is there a long division macro? [duplicate]

I want to do regular long division in latex. See also: http://en.wikipedia.org/wiki/Long_division Is there a latex macro for this ? Edit: I actually want to use it in mathjax, is this possible ?
6
votes
1answer
159 views

Applying condition around \intertext and \shortintertext leaves excess vertical space

When I try to make either \intertext or \shortintertext conditional I get excess vertical spacing prior to the conditional text as per the MWE below. Note the excess vertical spacing prior to "Albert ...
2
votes
1answer
56 views

Automate replacement of `\not` when in `\bm` mode

Hendrik Vogt has provided a \longnot macro to alleviate the issues related to Interaction of \boldmath and \not. This seems to work fine, but I run into a snag when I try to automatically use ...
2
votes
2answers
134 views

How to define new command for commands like \frac{} or \int{}^{}?

We know that we could define a new command for boldfaced or calligraphic C, for example I can define \newcommand{\Cx}{\mathbb{C}}, which will produce the boldfaced C, i.e. $\mathbb{C}$ for me. But how ...
7
votes
2answers
114 views

Using a character as a macro within another macro in (La)TeX

Goal: What I would like to do is to allow _ and ^ to be used to generate sub and superscripts in text mode only within a specific macro. I know that I can make _ and ^ active throughout the document, ...
5
votes
3answers
111 views

Remove math from command parameter to get only the letters

I use a little command, which prints new defined terms in bold, adds a label and adds them to the index. \newcommand*{\defined}[1]{{\bf #1}\label{#1}\index{#1}} Now if I do \defined{$G$-invariant} ...
10
votes
1answer
194 views

Interaction of \boldmath and \not

It seems that using \boldmath (or \bm) along with the \not does not quite work so well. Here is an example using \not\subseteq and \not\le where the line representing negation does not stretch ...
4
votes
1answer
96 views

cool package derivative and eulervm \mathbold fails with 'Missing control sequence inserted.'

Compiling \documentclass{article} \usepackage{cool} \usepackage{eulervm} \begin{document} $\D{a}{T}$ $\pderiv{a}{T}$ $\mathbold{T}$ $\D{a}{\mathbold{T}}$ $\pderiv{a}{\mathbold{T}}$ ...
3
votes
1answer
148 views

How do I create the following macros?

I would like to define the following macros. \newcommand{\NC}{\ensuremath{\mathbf{NC}}} \newcommand{\NC}[1]{\ensuremath{\mathbf{NC^{#1}}}} But LaTeX complains that \NC is already defined. So, I ...
5
votes
2answers
382 views

Shortcuts and/or user-defined shortcuts for math symbols in LaTeX?

I am very new to being able to use LaTeX to type up mathematical papers, and I just got my "system" set up. Currently I have installed TexWorks, and MikTex, and I have put together a 'hello world' ...
2
votes
1answer
60 views

Custom Command cannot use equation mode?

I have defined a new command below, but when ever I pass an equation into, it will not work. \newcommand{\defn}[1]{ {\textbf{Definition}}\\ \parbox{5.2in}{\begin{flushright} ...
4
votes
3answers
179 views

How do I define a math mode formula with a caret ^ in LaTex?

This question has two parts. First, is there a way to define a macro only for math mode? Second, how do I specifically get the following definition to work correctly? \def\fi{f^{-1}} One ...
8
votes
3answers
154 views

Useful macro definitions

This question is related to Question: linebreak in macros, however it is not asking for the same information and I separated it out: In my documents, I make use of commands like the following: ...
7
votes
2answers
162 views

How do I create the following macro

How do I create this where {a}{b}{c} are variables for a possible math formula?
8
votes
3answers
157 views

How can you tell whether a given macro is meant to be used in text mode or maths mode?

I recently read answer that discouraged the use of \ensuremath on the grounds that one should know whether each command is meant to be used in math mode or text mode. Given a command, how can you tell ...
7
votes
2answers
146 views

Passing an argument with the alignment operator (&) to a macro within another aligned environment

I am trying to write macros for quickly formatting matrices in math mode. Here is a simple, working example: \documentclass{article} \usepackage{amsmath} ...
0
votes
0answers
40 views

Math mode in theoremstyle head spec [duplicate]

Possible Duplicate: \overline outside of math mode I have three major elements in my LaTeX document; the first one is a new command \theoremhead[1]{\underline{\overline{#1}}} The second ...
9
votes
1answer
62 views

\@ifnextchar inside pmatrix?

I created a function which handles a superscript followed after the function. I do that by using \@ifnextchar^. Everything works well, except in any pmatrix environment. Why? As a quick-and-dirty ...
7
votes
3answers
290 views

parse variable length comma separated list into command

I've been trying to modify the solution here into a LaTeX3 command that takes a variable length comma separated list of numbers and an optional argument (a unit) and prints the square root of the sum ...
16
votes
1answer
202 views

How do I make a macro require math mode?

I have defined a macro that I would like to be used exclusively in math mode. In order to enforce this, I would like the macro to throw an error message whenever it is used outside of math mode. What ...
4
votes
3answers
173 views

Command to uppercase the first letter of a maths command

This question is a bit similar to Command to uppercase the first letter of each word in a sentence. What I want is to build a new command for being used just at math mode, using the ...
1
vote
0answers
31 views

Binary Logarithm Function [duplicate]

Possible Duplicate: Define additional math operators to be typeset in roman Math mode provides different functions to use in formulas like \sin, \cos, \tan or \log. According to Wikipedia, ...
8
votes
1answer
99 views

Creating temporary definitions for commands

In the context of writing something like homework solutions for a math class, I often face an awkward situation. Each problem will have some idiomatic functions that are cumbersome and error prone to ...
3
votes
1answer
112 views

Defining macros based on environment

Right now, I have two macros, \intersects and \union, that simply point back to \cap and \cup respectively. Unfortunately, to have nice typesetting in display-like environments, I need to use \bigcap ...
4
votes
1answer
73 views

Define commands for symbols with index, combine with accents

To facilitate writing of formulas that contain symbols with subscript, I often define custom commands. However, combining these with accents gives unpleasant results. Is there any way to define such ...
5
votes
2answers
228 views

math environment again

This follows a previous post which can be found here. I'm now trying to used that command but I get lots of compilation mistakes and I really don't understand where the problem comes from. This is how ...
7
votes
1answer
121 views

Creating a customizable n-ary operator?

I'd like to be able to create a customizable n-ary operator that behaves like \sum or \bigoplus but which takes an arbitrary symbol as an argument. The closest that I have been able to come to ...
14
votes
2answers
246 views

Removing double negative signs in equations

Intro: I am attempting to write a macro which can remove any extra negative signs in a general equation: 15.2 + -3.1 would be changed to: 15.2 - 3.1 when using the commands: ...
4
votes
0answers
66 views

How to use \ifinner to differentiate between text math and display math mode? [duplicate]

Possible Duplicate: Is there a test for the different styles inside maths mode? This is my first post here, so I can't promise to get all formatting right, but I'll try. Consider the ...
1
vote
1answer
149 views

Redefine a built-in math command [duplicate]

Possible Duplicate: Can I redefine a command to contain itself? I'm trying to redefine the \int command so that it will always do \int \!. So here's my attempt at that: ...
8
votes
2answers
4k views

Converting numbers to scientific notations

I have some numbers output from Matlab and I want to show them as tables in LaTeX. The numbers are in the form 0.14190949656253118000 or 0.01234e-3 and I want to show them in scientific notation. How ...
5
votes
2answers
179 views

Make sure the spacing of a macro for a binary operator

I define a macro as follows: \newcommand{\abs}[1]{{#1}^{\sharp}} But I realize that $a \abs{\sqcup} b$ is not exactly same as $a \sqcup^\sharp b$: The first one does not leave enough space between ...
5
votes
1answer
441 views

Using \leftroot{}, \uproot{} with closed square root symbol

As mentioned in this answer to Nice-looking p-th roots the amsmath package provides \leftroot{} and \uproot{} which allow you to move the position of the root to the left, and up in small increments. ...
8
votes
1answer
228 views

Creating Macros for Math Text

The built-in commands for text in math mode, such as \sup, are formatted very nicely. How can I define a macro for some short text that is to appear multiple times in math mode (such as "diam"), so ...
4
votes
1answer
51 views

Is it possible to create an assertion of minimum spacing in a command? [duplicate]

Possible Duplicate: Horizontal Spacing: double \hspace removal? I'm trying to keep my document as abstract as possible since I'm likely to change representation of the terms I'm using on a ...
4
votes
1answer
1k views

Vertical addition and multiplication and long division

Is there in existence packages that recreate the following environments: Some of the above have been discussed like in the How to present a vertical multiplication but what I am interested in is if ...
10
votes
2answers
560 views

Is there a \phantom considering cramped style?

In LaTeX2e, \phantom is defined as \def\vphantom{\v@true\h@false\ph@nt} \def\hphantom{\v@false\h@true\ph@nt} \def\phantom{\v@true\h@true\ph@nt} \def\ph@nt{% \ifmmode ...
5
votes
1answer
123 views

Writing a macro which will know the current state

I wish to write a macro which will be able to tell whether the machine is currently in mathmode or not. The pseudo-code is: IF IN MATHMODE{ %commands } ELSE{ %other commands } Is such a thing ...
2
votes
2answers
1k views

\newcommand gives errors in math mode (with or without arguments)

I'm trying to define a custom command for use in math mode, defined as \newcommand{\deriv2}[2]{\ensuremath{\frac{\partial^2 {#1}}{\partial {#2}^2}}} Other non-math mode \newcommands work in my ...
4
votes
4answers
338 views

New command for special elements in parenthesis

Sequences of elements like $\{x_n\}_{n\in\mathbb{N}}$ are to awful to type. And they are very common, not only sequences of elements, but families of sets and some other sorts of mathematical ...
14
votes
2answers
215 views

Placing math environments inside math environments

I have a macro which appears throughout my document in various places: \newcommand{\placefraction}[2]{ $\frac{#1}{#2}$ } Sometimes it is placed with regular text. Sometimes it is placed within ...
4
votes
1answer
184 views

Optional math symbols as arguments to custom command

I have a custom command defined as \newcommand{\transition}[1]{$\stackrel{\texttt{#1}}{-->}$} The argument that I pass to the command can sometimes be normal text and thus is formatted using ...

1 2