Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would rather have always have my tensor product look like $A\underset{R}{\otimes}B$ but still write $A\otimes_R B$. Is there a way to make this happen by some command in the preamble? (it's ok if it only works in display mode)

share|improve this question
3  
\bigotimes is a symbol that takes limits, so use that instead. –  barbara beeton Apr 16 at 8:58
    
One would use that in the sense of \sum for addition. In math sometimes you have to specify over which ring one does the tensor product (of just two modules). –  Peter Patzt Apr 16 at 9:08
    
An idea I just had would be something like \renewcommand{\tensor}{\ensuremath\otimes\limits} but it does not work because \otimes is not a math operator. –  Peter Patzt Apr 16 at 9:16
    
you could then try \mathop{\opotimes}{$\otimes$} (i've forgotten which code says this takes limits, and i'm not sure this syntax is exactly correct either, but it's in the right direction). or \DeclareMathOperator from amsmath. –  barbara beeton Apr 16 at 9:21

1 Answer 1

up vote 6 down vote accepted

Perhaps you like the ring to go below the tensor product symbol, but typography doesn't. Here's why:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\tens}[1]{%
  \mathbin{\mathop{\otimes}\limits_{#1}}%
}

\begin{document}

Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, but note that
it will have a very bad influence on the spacing of
lines.

\end{document}

enter image description here

A simple change will make what you perhaps prefer, but I'm not sure to like it very much.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\tens}[1]{%
  \mathbin{\mathop{\otimes}\displaylimits_{#1}}%
}

\begin{document}

Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.
\[
M\tens{R}N
\]
Here is a tensor product $M\tens{R}N$, note that
it won't have a very bad influence on the spacing of
lines.

\end{document}

enter image description here


You can have \tens work with the usual syntax:

\documentclass{article}
\usepackage{xparse}

\NewDocumentCommand{\tens}{t_}
 {%
  \IfBooleanTF{#1}
   {\tensop}
   {\otimes}%
 }
\NewDocumentCommand{\tensop}{m}
 {%
  \mathbin{\mathop{\otimes}\displaylimits_{#1}}%
 }

\begin{document}
In line we have $M\tens N=M\tens_{R}N$, but displayed we have
\[
M\tens N=M\tens_{R}N
\]
\end{document}

enter image description here

A more LaTeX3 savvy implementation:

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\tens}{ }
 {
  \patzt_tens:
 }

\cs_new_protected:Npn \patzt_tens:
 {
  \peek_catcode_remove:NTF \c_math_subscript_token
   {
    \patzt_tensop:n
   }
   {
    \otimes
   }
 }
\cs_new_protected:Npn \patzt_tensop:n #1
 {
  \mathbin{\mathop{\otimes}\displaylimits\c_math_subscript_token{#1}}
 }
\ExplSyntaxOff

\begin{document}
In line we have $M\tens N=M\tens_{R}N$, but displayed we have
\[
M\tens N=M\tens_{R}N
\]
\end{document}
share|improve this answer
    
@PeterPatzt I'll tell you that in my young years as a LaTeX user I had to use \otimes many times and I too wanted the ring below it; but I realized that it's not so nice, after all. –  egreg Apr 16 at 9:40
    
Wow, that is pretty impressive stuff (to me)! Thanks alot. (I cannot up your answer twice :( ) –  Peter Patzt Apr 16 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.