tud-cd / tudscr

TUD-Script
Other
106 stars 23 forks source link

Math symbols not displayed correctly when using mdsymbol package #45

Open siegmund42 opened 4 years ago

siegmund42 commented 4 years ago

MWE:

\documentclass{tudscrreprt}

\usepackage{mdsymbol}

\begin{document}

$P \propto f \cdot U^2$

\end{document}

Using pdflatex to build pdf.

Expected output: image (Same output as when removing the mdsymbol package)

Actual output: image

I need the mdsymbol package for cleveref and similar. Yes, it could be replaced by the amssymb package, but some thread stated that these symbols do not fit so nicely to the OpenSans font.

What should I do from here - is this combination unsupported?

Debug info:

$ tlmgr info tudscr
package:     tudscr
category:    Package
shortdesc:   Corporate Design of Technische Universitat Dresden
longdesc:    The TUD-Script bundle provides both classes and packages in order to create LaTeX documents in the corporate design of the Technische Universitat Dresden. It bases on the KOMA-Script bundle, which must necessarily be present. For questions, problems and comments, please refer to either the LaTeX forum of the Dresden University of Technology or the GitHub "tudscr" repository. The bundle offers: the three document classes tudscrartcl, tudscrreprt, and tudscrbook which serve as wrapper classes for scrartcl, scrreprt, and scrbook, the class tudscrposter for creating posters, the package tudscrsupervisor providing environments and macros to create tasks, evaluations and notices for scientific theses, the package tudscrfonts, which makes the corporate design fonts of the Technische Universitat Dresden available for LaTeX standard classes and KOMA-Script classes, the package fix-tudscrfonts, which provides the same fonts to additional corporate design classes not related to TUD-Script, the package tudscrcomp, which simplifies the switch to TUD-Script from external corporate design classes, the package mathswap for swapping math delimiters within numbers (similar to ionumbers), the package twocolfix for fixing the positioning bug of headings in twocolumn layout, and a comprehensive user documentation as well as several tutorials.
installed:   Yes
revision:    52503
sizes:       src: 1833k, doc: 4405k, run: 1981k
relocatable: No
cat-version: 2.06e
cat-date:    2019-10-23 17:07:58 +0200
cat-license: lppl1.3c
cat-topics:  dissertation class
cat-contact-bugs: https://github.com/tud-cd/tudscr/issues
cat-contact-repository: https://github.com/tud-cd/tudscr
cat-contact-support: https://latex.wcms-file3.tu-dresden.de/phpBB3/index.php
collection:  collection-publishers
$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.36; using libpng 1.6.36
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01
mrpiggi commented 4 years ago

Well, that's kind of tricky. Package mdsymbol redeclares some default symbol fonts in an incompatible manner. For you particular problem you could do something like

\documentclass{tudscrreprt}

\let\savedpropto\propto
\let\savedcdot\cdot
\usepackage{mdsymbol}
\let\propto\savedpropto
\let\cdot\savedcdot

\begin{document}

$P \propto f \cdot U^2$

\end{document}

Nevertheless, I have to think about a more general solution for the next version.

siegmund42 commented 4 years ago

Although this is quite hacky and requires a lot of caution when using more symbols it works...

Is there a list of symbols that are redeclared by mdsymbol?

mrpiggi commented 4 years ago

Unfortunately not. This is something, I will have to do by hand :(

patrickmelix commented 4 years ago

Just saw this too, quite dangerous when compiling a large document with equations copy-pasted from another document... Perhaps putting a warning to the Doc is needed here? Especially since I do not get any warnings about this in my log. I just get wrong symbols in the document.

siegmund42 commented 4 years ago

I just discovered that this is even the case for the plus sign - just add $a + b$ to the mwe above. The suggested workaround does not work in this case:

\let\savedplus\plus
\usepackage{mdsymbol}
\let\plus\savedplus

Undefined control sequence. $a \plus

This is even more serious. I agree, at least a warning should be added..

mrpiggi commented 11 months ago

As TUD-Forum will be shut down, the following similar issue is recorded here:

Loading additional font packages can blow the maximum number of available math alphabets. Therefore, an interface for using dedicated symbols from a font without loading the according package would be nice. Using the approach from https://tex.stackexchange.com/a/14406/38481, this is a first PoC

\documentclass{tudscrreprt}
\iftutex
  \usepackage{fontspec}
\else
  \usepackage[T1]{fontenc}
  \usepackage[ngerman=ngerman-x-latest]{hyphsubst}
\fi
\usepackage{mathrsfs}
\usepackage{siunitx}

% Workaround
%\usepackage{txfonts}
\makeatletter
\newcommand*\txmathsymbol[3][\mathord]{#1{\@txmathsymbol{#2}{#3}}}
\newcommand*\@txmathsymbol[2]{\mathchoice%
  {\@@txmathsymbol{#1}{#2}\tf@size}%
  {\@@txmathsymbol{#1}{#2}\tf@size}%
  {\@@txmathsymbol{#1}{#2}\sf@size}%
  {\@@txmathsymbol{#1}{#2}\ssf@size}%
}
\newcommand*\@@txmathsymbol[3]{\mbox{\fontsize{#3}{#3}\txsymbol{#1}{#2}}}
\newcommand*\txsymbol[2]{\begingroup\usefont{U}{#1}{m}{n}\char#2\endgroup}
\makeatother
\newcommand*\multimapboth{\txmathsymbol[\mathrel]{txsyc}{19}}

\begin{document}
$a \multimapboth b$

$a \upnu b$

\end{document}