Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with custom preamble for math preview #1545

Open
nicolaslesquoy opened this issue Nov 17, 2021 · 0 comments
Open

issue with custom preamble for math preview #1545

nicolaslesquoy opened this issue Nov 17, 2021 · 0 comments

Comments

@nicolaslesquoy
Copy link

nicolaslesquoy commented Nov 17, 2021

Hello, I want to use with the math preview feature the following macros that use in almost all my documents :

\begingroup
    \def\tmpa#1{%
        \if\relax#1 \expandafter\noexpand \else
            \expandafter\gdef\csname double#1\endcsname{\mathbb #1} %
            \expandafter\gdef\csname script#1\endcsname{\mathcal #1} %
			\expandafter\gdef\csname frak#1\endcsname{\mathfrak #1} %
            \expandafter\gdef\csname cal#1\endcsname{\mathscr #1} %
        \fi \tmpa
    }
    \tmpa ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\relax
\endgroup

I wrote it in the LaTeXTools.sublime-settings file as :

// An array of the used packages, from which the file for the live preview
	// will be generated.
	// Just write \\usepackage{packagename} to include other packages.
	// (The xcolor package will be present, even if not in this list.)
	"preview_math_template_packages": [
		"\\usepackage{amsmath}",
		"\\usepackage{amssymb}",
		"\\IfFileExists{mathrsfs.sty}{\\usepackage{mathrsfs}}{}",
		"\\IfFileExists{mathtools.sty}{\\usepackage{mathtools}}{}",
		"\\IfFileExists{esvect.sty}{\\usepackage[g]{esvect}}{}",
		"\\IfFileExists{latexsym.sty}{\\usepackage{latexsym}}{}",
		"\\IfFileExists{mathtools.sty}{\\usepackage{mathtools}}{}"
	],

	// An string of the remaining preamble (not packages) for the file,
	// which generates the math live preview.
	// Can also be an array, with an string for each line (as in the packages).
	// For technical reasons DON'T include other files.
	"preview_math_template_preamble": [
		"\\begingroup\\def\\tpmab#1{\\if\\relax#1\\expandafter\\noexpand\\else\\expandafter\\gdef\\csname double#1\\endcsname{\\mathbb #1}}\\tmpab ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\relax\\endgroup",
		"\\begingroup\\def\\tpmac#1{\\if\\relax#1\\expandafter\\noexpand\\else\\expandafter\\gdef\\csname script#1\\endcsname{\\mathcal #1}}\\tmpac ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\relax\\endgroup",
		"\\begingroup\\def\\tpmaf#1{\\if\\relax#1\\expandafter\\noexpand\\else\\expandafter\\gdef\\csname frak#1\\endcsname{\\mathfrak #1}}\\tmpaf ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\relax\\endgroup",
		"\\begingroup\\def\\tpmasc#1{\\if\\relax#1\\expandafter\\noexpand\\else\\expandafter\\gdef\\csname cal#1\\endcsname{\\mathscr #1}}\\tmpasc ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\\relax\\endgroup",
	],

Those modifications are not used when I type in a math environnement for instance \scriptC instead of mathcal{C}.
Thank you in advance for any advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant