Math & Sciencenewcommand with brackets and index

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
PhantoX
Posts: 1
Joined: Tue Feb 01, 2011 1:50 pm

newcommand with brackets and index

Post by PhantoX »

Hi all!

My MVE is

Code: Select all

\documentclass{article}

\usepackage[latin2]{inputenc}
\usepackage[T1]{fontenc}
\def\magyarOptions{defaults=hu-min}
\usepackage[magyar]{babel}
\usepackage{amsmath}
\newcommand{\grad}[1]{{\mathrm{grad}} {\left( {#1} \right)}}% for gradient
\begin{document}

\begin{align}
	\grad_P^2{\varphi}
	\\
	\grad{\phi}
\end{align}

\end{document}
and the output:
http://phantox.tvn.hu/proba.pdf

I want to create a command, what "compatible" with the upper&lower index and contains brackets: My default \grad command is

Code: Select all

\newcommand{\grad}[1]{\mathrm{grad\;}#1}
this command compatible with index and i want to fill out with brackets, but i can't.
[Hun]PhantoX -- Tibi
PS: Sorry for my bad English.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply