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.

In my document using \documentclass[12pt]{report}, I have tables containing an index and a inequality in each line. As it's a long list, it's a supertabular with columns c|rcr. Sample data of one line is 1 & x_{i,j} & \leq & 0 \\.

Now, in this specific table, I prefer typewriter style. Additionally, the length of these inequalities is too high to fit with normal text size, therefore, I also reduce the font size. To have this in every math environment without repetition of commands I've declared a specific environment:

\newenvironment {specialMath} [0] {} {}
\AtBeginEnvironment{specialMath}
{
\everymath{\scriptstyle\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}}
\everydisplay{\scriptstyle\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}}
}

It works, in the sense that everything is displayed at the size of subscripts. However, printed on A4, this is a bit too small.

In summary, \textstyle is too large, \scriptstyle too small, but I do not want to adjust all font sizes (that can be done with \DeclareMathSizes{... in the preamble, afaik).

How do I fine tune the font size locally, not globally, in a set of math environments?

A minimal compilable example (pdflatex), without the table:

\documentclass[12pt]{report}
\usepackage{amsmath}                                 % math environment
\usepackage{etoolbox}                                % environment customization
\usepackage{supertabular}                            % multi-page tables

\newenvironment {specialMath} [0] {} {}
\AtBeginEnvironment{specialMath}
{
\everymath{\scriptstyle\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}}
\everydisplay{\scriptstyle\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}}
}

\begin{document}

$x_{i,j} \leq 0$ % normal style
\begin{specialMath}
\begin{supertabular}{r}
$x_{i,j} \leq 0$\\ % typewriter, slightly smaller
\end{supertabular}
\end{specialMath}
$x_{i,j} \leq 0$ % normal style again
\end{document}

Without the supertabular, somehow it's not typewriter font. It will be used in a tabular anyway, but you can ignore that fact.

share|improve this question
1  
May I ask why you are doing this? It sounds to me to be something that ends up having a rather inconsistent design. –  daleif Dec 18 '13 at 12:16
    
Your example does not print typewriter style for me. Anyway have you consider \scalebox{0.9}{$x_{i,j} \leq 0$} with \usepackage{graphicx}? –  Andrew Swann Dec 18 '13 at 12:16
    
@daleif The data is too long to fit in one row, as I've written in my question. It has to be smaller for fitting into one row. The tables are all at the end, so it's not really inconsistent. –  stefan Dec 18 '13 at 12:19
    
@AndrewSwann You're right, curiously it's not typewriter style, not sure why though. I will correct this if I find the error. But this shouldn't affect the question. –  stefan Dec 18 '13 at 12:20
    
@AndrewSwann Updated, curiously it works with a supertabular wrapper, but that's how I use it anyway. I suspect supertabular includes the correct package, but whatever. –  stefan Dec 18 '13 at 12:28

1 Answer 1

I'm not sure about \scriptstyle; here's what I'd do:

\documentclass[12pt]{report}
\usepackage{amsmath}
\usepackage{supertabular}

\newenvironment{specialMath}
  {\footnotesize\everymath{\fam\thettfam}}
  {}
\AtBeginDocument{%
  \sbox0{$\mathtt{\xdef\thettfam{\the\fam}}$}%
}

\begin{document}

$x_{i,j} \leq 0$ % normal style
\begin{specialMath}
\begin{supertabular}{r}
$x_{i,j} \leq 0$\\ % typewriter, slightly smaller
\end{supertabular}
\end{specialMath}
$x_{i,j} \leq 0$ % normal style again
\end{document}

enter image description here

share|improve this answer
    
Please explain your code. It's usable, yes, but not reproducible in the sense that for any small modification I would have to come back here. –  stefan Dec 19 '13 at 8:37
    
@stefan The code does the same as yours, but in an easier way; instead of \scriptsize, a \small declaration is issued. It wasn't really clear what you need the code for. –  egreg Dec 19 '13 at 9:36
    
well I didn't understand the code, I simply copied it from another answer here on tex.stackexchange.com. It did what I wanted, but not completely. It's a cryptic hack and I would like to understand a bit more. –  stefan Dec 19 '13 at 9:46

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.