3

How do I change the height of the superscripts (to make them higher) and the depth of the subscripts (to make them lower) in math mode formulas in LaTeX? For the subscripts I have tried the following code:

$
\fontdimen16\textfont2=5pt
\fontdimen17\textfont2=5pt
$

but only some subscripts have changed, not all.

I guess I discovered what is hapenning, however I don´t know how to avoid it. The problem is that inside an environment ("exemplo") the changes are not applied (they are applied on the outside however). How can I make the changes apply everywhere (inside and outisde environments)? I prepared the MWE:

\documentclass{scrbook}
\usepackage[a4,center,cam,dvips,noinfo]{crop}
\usepackage [brazilian] {babel}
\usepackage [utf8] {inputenc}
\usepackage [T1] {fontenc}
\usepackage {amsfonts}          
\usepackage {amsmath,amssymb,latexsym}
\usepackage {ntheorem}

\newcommand {\vtr} {\vartriangleright}
\newcommand{\destaque}[1]{\textbf{#1}}
\newtheorem {Ex} {\small\rmfamily\upshape$\!$Exemplo} [chapter]
\newenvironment{exemplo}
{
\begin{Ex}
\small
\rmfamily
\upshape
}
{\hspace*{\fill}$\star\star\star$
\end{Ex}
}  

\begin {document}
$
\fontdimen14\textfont2=4pt
\fontdimen15\textfont2=4pt
\fontdimen16\textfont2=10pt
\fontdimen17\textfont2=10pt
$
\section {Igualdade-$\beta$}

Um termo $P$ é dito \destaque{$\beta$-igual} ou \destaque {$\beta$- 
conversível} a um termo $Q$, denotado $P =_{\beta} Q$, se e somente se 
$Q$ puder ser obtido a partir de $P$ por uma sequência finita 
(eventualmente vazia) de contrações-$\beta$, contrações-$\beta$ 
reversas e mudanças de variáveis ligadas. Ou seja, $P =_{\beta} Q$ se e 
somente se existir $P_0, ..., P_n (n\geq 0)$ tal que: $$(\forall i \leq 
n-1), (P_i \vtr_{1\beta} P_{i+1}) \mbox {\ ou\ } (P_{i+1} \vtr_{1\beta} 
P_i) \mbox {\ ou\ } (P_i \equiv_{\alpha} P_{i+1}),$$ $$P_0 \equiv P,$$ 
$$P_n \equiv Q.$$

\begin {exemplo}
Sejam $P\equiv (\lambda xyz.xzy)(\lambda xy.x)$ e $Q\equiv (\lambda 
xy.x)(\lambda x.x)$. Então $P=_{\beta}Q$, ou seja:
$$(\lambda xyz.xzy)(\lambda xy.x) =_{\beta} (\lambda xy.x)(\lambda 
x.x)$$

De fato, pode-se notar inicialmente que:
\begin {eqnarray*}
(\lambda xyz.xzy)(\lambda xy.x) & \equiv_{\alpha} & (\lambda xyz.xzy) 
(\lambda uv.u) \\
                            & \vtr_{1\beta}   & \lambda yz.(\lambda 
uv.u)zy \\
                            & \vtr_{1\beta}   & \lambda yz.(\lambda 
v.z)y \\
                            & \vtr_{1\beta}   & \lambda yz.z
\end {eqnarray*}                                
Além disso, que:
\begin {eqnarray*}
(\lambda xy.x)(\lambda x.x) & \equiv_{\alpha} & (\lambda xy.x)(\lambda 
w.w) \\
                        & \vtr_{1\beta}   & \lambda y.(\lambda w.w) \\
                        & \equiv          & \lambda yw.w \\
                        & \equiv_{\alpha} & \lambda yz.z
\end {eqnarray*}                                
Finalmente, pode-se considerar $P_0,P_1,P_2,P_3,P_4,P_5,P_6,P_7$ tais 
que:
\begin {eqnarray*}
P = P_0 & = & (\lambda xyz.xzy)(\lambda xy.x) \\
P_1 & = & (\lambda xyz.xzy)(\lambda uv.u) \\
P_2 & = & \lambda yz.(\lambda uv.u)zy \\
P_3 & = & \lambda yz.(\lambda v.z)y \\
P_4 & = & \lambda yz.z \\
P_5 & = & \lambda yw.w \\
P_6 & = & (\lambda xy.x)(\lambda w.w) \\
Q = P_7 & = & (\lambda xy.x)(\lambda x.x)
\end {eqnarray*}
Para concluir que $P=_{\beta}Q$, basta observar que $P_0 
\equiv_{\alpha} P_1$, $P_1 \vtr_{1\beta} P_2$, $P_2 \vtr_{1\beta} P_3$, 
$P_3 \vtr_{1\beta} P_4$, $P_4 \equiv_{\alpha} P_5$, $P_6 \vtr_{1\beta} 
P_5$ e $P_6 \equiv_{\alpha} P_7$.
\end {exemplo}
\end {document}

Thanks in advance, Marcus.

P.S.

What I did was to create a new command:

\newcommand{\setsubsuperscripts}{
$
\fontdimen14\textfont2=4pt
\fontdimen15\textfont2=4pt
\fontdimen16\textfont2=4pt
\fontdimen17\textfont2=4pt
$
}

and use it after \begin{document} (for global changes) and in each environment, since this command does not affect new environments.

That works, but I would prefer use the command only once and have its effects spread the whole document, including the new environments.

9
  • Not really. It simply says that I should use the commands that I am already using.
    – Marcus
    Commented May 17 at 13:17
  • 2
    In this case, you should provide a minimal working example (MWE) .
    – jlab
    Commented May 17 at 13:21
  • OK, I´ll make one,
    – Marcus
    Commented May 17 at 13:30
  • I guess I discovered what is hapenning, however I don´t know how to avoid it. The problem is that inside an environment ("exemplo") the changes are not applied (they are applied on the outside however). How can I make the changes apply everywhere (inside and outisde environments)? My original post has been updated with a MWE.
    – Marcus
    Commented May 17 at 13:52
  • if you change the settings inside $...$ the settings will be discarded at the end of that math expression. Remove the $ as your settings will have no effect at all in an empty math list. Also all of parameters 13-19 affect this not just 16-17 see tex.stackexchange.com/questions/88991/… Commented May 17 at 13:57

1 Answer 1

1

Assignments to \fontdimen are global.

What happens with your code is that the changes you do at the beginning are valid for \normalsize, but \small uses a different \textfont2, whose \fontdimens would be unaffected.

You can decide what value you want to use in \normalsize and \small (and possibly with other font sizes) and set them at begin document producing an empty formula in each of the sizes.

\documentclass{scrbook}
\usepackage[a4,center,cam,noinfo]{crop}
\usepackage [brazilian] {babel}
\usepackage [utf8] {inputenc}
\usepackage [T1] {fontenc}
\usepackage {amsfonts}          
\usepackage {amsmath,amssymb,latexsym}
\usepackage {ntheorem}

\newcommand{\vtr}{\vartriangleright}
\newcommand{\destaque}[1]{\textbf{#1}}

\theoremheaderfont{\small\normalfont\bfseries}
\theorembodyfont{\small\normalfont}
\newtheorem{exemplo}{Exemplo}[chapter]

% fix the values, these are wrong
\newcommand{\normalsizesubscripts}{%
  \fontdimen14\textfont2=4pt
  \fontdimen15\textfont2=4pt
  \fontdimen16\textfont2=10pt
  \fontdimen17\textfont2=10pt
}
\newcommand{\smallsubscripts}{%
  \fontdimen14\textfont2=4pt
  \fontdimen15\textfont2=4pt
  \fontdimen16\textfont2=10pt
  \fontdimen17\textfont2=10pt
}
% do the settings
\AtBeginDocument{\sbox0{$\normalsizesubscripts$\small$\smallsubscripts$}}

\begin{document}

\section{Igualdade-$\beta$}

Um termo $P$ é dito \destaque{$\beta$-igual} ou \destaque{$\beta$-conversível}
a um termo $Q$, denotado $P =_{\beta} Q$, se e somente se 
$Q$ puder ser obtido a partir de $P$ por uma sequência finita 
(eventualmente vazia) de contrações-$\beta$, contrações-$\beta$ 
reversas e mudanças de variáveis ligadas. Ou seja, $P =_{\beta} Q$ se e 
somente se existir $P_0,\dots, P_n (n\geq 0)$ tal que: 
\begin{gather*}
(\forall i \leq 
n-1), (P_i \vtr_{1\beta} P_{i+1}) \mbox {\ ou\ } (P_{i+1} \vtr_{1\beta} 
P_i) \text{ ou } (P_i \equiv_{\alpha} P_{i+1}),\\
P_0 \equiv P, \\
P_n \equiv Q.
\end{gather*}

\begin{exemplo}
Sejam $P\equiv (\lambda xyz.xzy)(\lambda xy.x)$ e $Q\equiv (\lambda 
xy.x)(\lambda x.x)$. Então $P=_{\beta}Q$, ou seja:
\[
(\lambda xyz.xzy)(\lambda xy.x) =_{\beta} (\lambda xy.x)(\lambda x.x)
\]

De fato, pode-se notar inicialmente que:
\begin{equation*}
\begin{aligned}
(\lambda xyz.xzy)(\lambda xy.x)
  & \equiv_{\alpha} (\lambda xyz.xzy) (\lambda uv.u) \\
  & \vtr_{1\beta} \lambda yz.(\lambda uv.u)zy \\
  & \vtr_{1\beta} \lambda yz.(\lambda v.z)y \\
  & \vtr_{1\beta} \lambda yz.z
\end{aligned}
\end{equation*}
Além disso, que:
\begin{equation*}
\begin{aligned}
(\lambda xy.x)(\lambda x.x)
  & \equiv_{\alpha} (\lambda xy.x)(\lambda w.w) \\
  & \vtr_{1\beta} \lambda y.(\lambda w.w) \\
  & \equiv \lambda yw.w \\
  & \equiv_{\alpha} \lambda yz.z
\end{aligned}
\end{equation*}
Finalmente, pode-se considerar $P_0,P_1,P_2,P_3,P_4,P_5,P_6,P_7$ tais 
que:
\begin{equation*}
\begin{aligned}
P = P_0 & = (\lambda xyz.xzy)(\lambda xy.x) \\
P_1 & = (\lambda xyz.xzy)(\lambda uv.u) \\
P_2 & = \lambda yz.(\lambda uv.u)zy \\
P_3 & = \lambda yz.(\lambda v.z)y \\
P_4 & = \lambda yz.z \\
P_5 & = \lambda yw.w \\
P_6 & = (\lambda xy.x)(\lambda w.w) \\
Q = P_7 & = (\lambda xy.x)(\lambda x.x)
\end{aligned}
\end{equation*}
Para concluir que $P=_{\beta}Q$, basta observar que $P_0 
\equiv_{\alpha} P_1$, $P_1 \vtr_{1\beta} P_2$, $P_2 \vtr_{1\beta} P_3$, 
$P_3 \vtr_{1\beta} P_4$, $P_4 \equiv_{\alpha} P_5$, $P_6 \vtr_{1\beta} 
P_5$ e $P_6 \equiv_{\alpha} P_7$.
\end{exemplo}

\end{document}

Of course you have to adjust the values to sensible ones.

Note how the definition of exemplo has been streamlined and made more efficient (and correct).

No LaTeX document should use them, so I fixed them: please, study the fixed code, so you can get a better typesetting.

The following picture is without the settings to \fontdimen, which I really don't think are necessary.

enter image description here

1
  • 1
    Thank you ver much.
    – Marcus
    Commented May 17 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .