3

I am using the mathastext package typsetting some historic literatures. I've chosen the Latin Modern Typewriter Light Condensed font for default font just on the consideration of saving paper. Here is the MWE:

\documentclass{article}
\usepackage[no-math]{fontspec}
\setmainfont{Latin Modern  Mono Light Cond}
\usepackage{amsmath}
\usepackage[basic]{mathastext}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,             
nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.
\begin{gather*}
1+\frac{1}{4}+\frac{1}{9}+\cdots =\frac{\pi}{6}\\
\frac{\ln x}{\ln\alpha}=\log_{\alpha}x\\
f(x)=\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)
\end{gather*}
\end{document}

output

You can see the Greek letters are too big. I compiled the code file via XeLaTeX BTW.

David Carlisle
  • 757,742
Jewmy
  • 33
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. I added your picture in, so the problem can be seen immediately. – mafp Jun 24 '13 at 10:45
  • Perhaps \usepackage[basic,eulergreek]{mathastext} \MTEulerScale{0.9} but Greek letters appear a bit too bold. –  Jun 24 '13 at 14:03
  • I also tried \usepackage[style=French,scale=0.88]{libgreek}\usepackage[basic]{mathastext} but again the glyphs appear too bold. –  Jun 24 '13 at 14:12

2 Answers2

2

Using mathspec to select the Greek glyphs from an OpenType font, here is with DejaVu Serif Condensed:

DejaVu Serif Condensed Greek DejaVu close-upvs DejaVu close-up not basic mathastext

(on the right I added the result of using mathastext without the basic option; in my opinion this is better: look at the = sign and at the (small) parentheses)

I did not experiment much more as I used the CharacterViewer on my Mac to try to identify candidate fonts, but the fonts from the TexLive 2013 repertory are not known to the system, so I only had the system fonts and a few I installed. Also note that for some reason I must specify the font filename when using xelatex with TexLive installed OpenType fonts.

\documentclass{article}
\usepackage{amsmath}
\usepackage[no-math]{fontspec}

\setmainfont[ExternalLocation]{lmmonoltcond10-regular}
% je ne peux pas faire ici sur TL2010:
% \setmainfont{Latin Modern Mono Light Cond}
% et ça ne marche pas non plus sur le Mac avec TL2013. 

\usepackage{mathspec}
%\setmathsfont(Greek)[Lowercase=Regular,Scale=0.92]{FreeMono}
%\setmathsfont(Greek)[Lowercase=Regular,Scale=0.92]{Courier New}
%\setmathsfont(Greek)[Lowercase=Regular,Scale=0.76]{DejaVu Sans ExtraLight}
\setmathsfont(Greek)[Lowercase=Regular,Scale=0.76]{DejaVu Serif Condensed}

    % previous tries
    % \usepackage[style=French,scale=0.88]{libgreek}
    % \usepackage[basic,eulergreek]{mathastext}
    % \MTEulerScale{0.9}

\usepackage[basic]{mathastext}
    %\MTgreekfont{cmr}\Mathastext
    %\MTgreekfont{cmtt}\Mathastext
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, 
placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris.
Nam arcu libero,              
nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue
eu neque. 
\begin{gather*}
1+\frac{1}{4}+\frac{1}{9}+\cdots =\frac{\pi}{6}\\
\frac{\ln x}{\ln\alpha}=\log_{\alpha}x\\
f(x)=\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)
\end{gather*}

\[ abcdefghijklmnopqrstuvwxyz \]
\[ αβγδεζηθικλμνξοπρςστυφχψω \]

\end{document}
  • Nice attempt. At least it shows why such a setup should be avoided. ;-) – egreg Jun 24 '13 at 16:19
  • @egreg Gusti e colori non si discutono ;-) –  Jun 24 '13 at 16:24
  • @egreg Thanks and please don't scare away my only disciple! –  Jun 24 '13 at 16:27
  • @jfbu You are the author of mathastext, right? It's a privilege to meet you. The package is very helpful to me. In the MWE above I ommited the package mnsymbol, which can provide more handsome symbols such like binary operations and relations. And your solution is good for me. Thank you. Maybe in the future I would have some other questions on using mathastext package, hope to see you that time again. – Jewmy Jun 25 '13 at 00:24
  • @jfbu I find that Open Sans Condensed Light maybe a nicer choice. You can try it by your free time. – Jewmy Jun 25 '13 at 00:39
  • Yes, thanks and I am glad if mathastext has some use. (summer being here, my internet access will soon become nil). As you use xelatex wouldn't mathspec suffice for your needs? (mathastext does not know how to do Greek with unicode fonts). Indeed Open Sans Condensed Light gives the best fit among the fonts I tried so far. Thanks for the pointer to mnsymbol too. Your combination Latin Modern Mono Light Cond and Open Sans Condensed Light would fit nicely two-column output. I added \frenchspacing to my testfile, the default spacing after ending dots perturbates me otherwise. –  Jun 25 '13 at 08:24
  • Thanks for mentioning MnSymbol. The minimal options to pass to mathastext for compatibility are noparenthesis and nolessnomore, and MnSymbol should then be loaded first. But it makes more sense to use mathastext with the basic option. Again mathastext should then be loaded after MnSymbol, this time principally because MnSymbol loads amsmath and amsmath must be loaded prior to mathastext for things like \log, \cos etc... to appear as expected. –  Jun 25 '13 at 10:29
  • @Jfbu I didn't expect that you would comment it in detail after answering the question. I think you are a warmhearted man. I don't use mathspec package because its last updating was four years ago and it often produces an option crash after I added it in my foremain text with fontspec. (For a test you can try: \documentclass{article}\usepackage{fontspec}\setmainfont{Latin Modern Mono Light Cond}\usepackage{mathspec}\setmathsfont(Greek)[Lowercase=Regular,Scale=0.808]{Open Sans Condensed Light}\begin{document}$\alpha$\end{document}) – Jewmy Jun 27 '13 at 03:01
  • @jfbu You might not notice yet if you don't use the basic option of mathastext, the plus and minus sign will not in same horizontal level with fractions' middle rule. At last, thanks for all your great efforts. – Jewmy Jun 27 '13 at 03:02
  • @Jewmy mathspec takes care itself of loading fontspec, so try \documentclass{article}\usepackage{mathspec}\setmainfont{ etc } etc. Options to fontspec may be given as options to mathspec and will be transmitted. Yes, the plus and minus from the text font usually are not centered on the mathematical axis. Thanks for you kind works and good luck for your project. –  Jun 27 '13 at 06:34
0

I don't have the ability to recreate your exact situation, because I don't have that condensed font available to me. However, if no font-based solution presents itself in another answer, this could be an alternate (if less preferred) method.

In essence, I use the scalerel package to redefine greek letters to a condensed version by sqeezing them laterally (in this case to a 70% original width setting). I do it with the \condense macro which redefines its (macro) argument in condensed form.

Below, I show the unchanged, then the changed charcters; then, the result. Obviously, if you adopted this approach, you would put the \condense{} invocations in the preamble.

\documentclass{article}
%\usepackage[no-math]{fontspec}
%\setmainfont{Latin Modern  Mono Light Cond}
\usepackage{amsmath}
\usepackage[basic]{mathastext}
\usepackage{scalerel}
\makeatletter
% Following 3 lines thanks to Prof. Enrico Gregorio, from:
% http://tex.stackexchange.com/questions/42318/
%   removing-a-backslash-from-a-character-sequence
\begingroup\lccode`\|=`\\
\lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}}
\newcommand{\@macro@name}[1]{\expandafter\removebs\string#1}
\newcommand*\condense[1]{%
  \expandafter\let\csname sv\@macro@name{#1}\endcsname#1%
  \def#1{\hstretch{.7}{\csname sv\@macro@name{#1}\endcsname}}%
}
\makeatother
\begin{document}

ORIGINAL: \(\alpha\mu\sigma\pi\)

\condense{\alpha}\condense{\mu}\condense{\sigma}\condense{\pi}
REVISED: \(\alpha\mu\sigma\pi\)

\begin{equation}
1+\frac{1}{4}+\frac{1}{9}+\cdots =\frac{\pi}{6}\\
\end{equation}
\begin{equation}
\frac{\ln x}{\ln\alpha}=\log_{\alpha}x\\
\end{equation}
\begin{equation}
f(x)=\frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)
\end{equation}

\end{document}

enter image description here

David Carlisle
  • 757,742
  • Normally, upon getting negative votes, I would retract the answer. In this case, however, I will leave it, because (contrary to the downvoter(s)) I think that, for someone who can't find a font-based solution to such a problem, this "workaround" provides an alternative in a pinch. – Steven B. Segletes Jun 24 '13 at 11:33
  • 2
    Compressing a font by scaling it like that, is the most horrible typographic crime I’ve seen in this website. No solution is better than a horrible one. – خالد حسني Jun 24 '13 at 14:02
  • @KhaledHosny I appreciate your opinion and will take it under advisement. I would point out though, that doing things like slanting a font are considered perfectly valid reconstructions. However, I also realize that that a horizontal compression changes the stroke modulation, which is what, perhaps, offends your sensibilities. – Steven B. Segletes Jun 24 '13 at 14:09
  • @KhaledHosny someone should provide here a picture of Khaled being squeezed horizontally to 70% ... ;-) –  Jun 24 '13 at 16:31
  • I was trying to be funny of course, true that I down voted the answer because I think it is a bad advice in general, but I’m not that offended, really :) – خالد حسني Jun 24 '13 at 17:16
  • @KhaledHosny I accept your comment in the humorous spirit it was intended, though I will note that, of the many facets that make LaTeX what it is, font glyphs seem to have the most ideological following. I will also note that "No solution is better than a horrible one"... until the boss wants the product on his desk by close of business. – Steven B. Segletes Jun 24 '13 at 17:32
  • @StevenB.Segletes: Such a lousy boss, don’t work for him :p – خالد حسني Jun 24 '13 at 18:46
  • @Steven B. Segletes Thanks for your answer. I quite agree with what you said, a kind philosophy of "better than none", right? But there are too many people of this field stand in perfectism. It is this character that makes the language and its peripheral soft step foreward. – Jewmy Jun 24 '13 at 23:53
  • @Jewmy Thanks for your kind words. These young ones don't remember the days of dot-matrix fonts and NEAR letter quality (NLQ). Now those qualify as typographic crimes. And yet, they served their purpose in the annals of typography. Let's face it, a condensed font is, almost by definition, a compromise of legibility and space. While I can appreciate the intrinsic beauty of, for example, an H. Zapf font, I also appreciate that, as representations of letters, they convey information. In the end, the message (content) is more important than the messenger (the glyph). – Steven B. Segletes Jun 25 '13 at 09:33