LaTeX typesetting plugin in Designer

Recommended Posts

OK, I'm very aware that maybe most of the designers and users of the awesome Affinity Designer are not into scientific posters, books or documents, but I'm a mathematician and I love the app myself, as much as I understand and use it. :)

Hence, I got a small, but important feature request: a plugin/native support which would allow one to use the power of "local" LaTeX typesetting for symbols, fonts and other scientific notations.

I am aware I could use the great LaTeXiT + drag & drop, but still, I envision my workflow as follows:

When I have a complicated figure to draw, I fire up Affinity Designer and I draw, but for annotations and everything font or math symbol related, I'm not quite covered. I have installed some versions of the native LaTeX fonts (CMU) to use system-wide, but some are missing and still doesn't feel the same. So for symbols, equations etc. I would like to be able to input a LaTeX formula (delimited by the well-known dollar-signs) and Affinity would typeset it locally, using the fonts included in the LaTeX distribution installed on my Mac.

What do you think? Honestly, I think that such a feature would be useful for all kinds of technical drawers, although they may use CAD-style apps. But you'll never know when you need a formula on your piece of art, right? :)

Moreover, in perspective, I'm sure this would provide immensely useful for the future Publisher app, with inter-operability.

Thank you for the support and the awesome apps!

Share on other sites

I think most of our students are using MathML. Respectively Matlab, Maple, Mathematica, etc. - I believe the most doesn't know LaTeX anymore.

When i have to draft an equation, i'm using the built in "Grapher". It can't be easier. Give it a try.

Ohne Titel.pdf

I don't use Photoshop and never used Illustrator.

Share on other sites

I've once typeset a booklet with mathematical formulas for students in Adobe InDesign for a client. While there are plugins like InMath, they are expensive and clumsy since they rely on hacks like baseline shifts and so on. There was another plugin that can be used an external formula editor like in Word, but it turned out the formulas didn't print properly and there were incorrect characters. Not to mention that these solutions are way too expensive if you only have a one-time project.

Back then, I, too, found LaTeXIt! for Mac to be the best solution since it allows you to type out small snippets of LaTeX and save it out to a PDF using XeTeX (XeTeX being a key part since this allows access to OpenType fonts to customize the look to match the text in the publication) or copy and paste it into other applications. But it's not ideal since customizing the fonts, look and kerning of the formulas takes loads of boilerplate code since LaTeX was never meant for lots of customization. Not to mention every formula was basically a linked image and had to be re-built for even the smallest change.

I don't think actual LaTeX integration would make a lot of sense. But I do think that built-in formula editing support for Affinity Publisher ("Maths Persona"?) would be a fantastic feature. Additionally, a way to quickly type LaTeX code simply as an input method (without having LaTeX installed, the formula subset would be enough) and a way to import MathML would make it really quick and flexible to create math-heavy documents.

It's not just a feature that benefits the few people who are professionally printing math-heavy publications. I'm certain that such a feature would position Affinity Publisher as a really attractive solution for teachers and educators for creating work sheets and the like. This demographic is currently mostly on Word because something like InDesign is just way out of the price range and learning curve that these people would consider. But at $49, I think it would be a no-brainer for every teacher. All it would probably take is a decent math typesetting feature for Publisher and a non-destructive graph plotting tool for Designer. The expressions parser is already there as part of the text input fields… Share this post Link to post Share on other sites I do agree that many professional editors and publishers do not use LaTeX. In fact, I'm mostly thinking about my own personal use, of course. But honestly, although I admit it's strictly a thing of preference, I never found any click-GUI-based solution better than good ol' LaTeX. I've tried MathML myself, as well as Mathematica/Maple/Matlab and different flavours of LaTeX and editors. I, for one, love things text-based, for example, for around 2 years, I'm living in the plain-text world almost exclusively (with Markdown and LaTeX). Formula integration, without actually relying on LaTeX is a good idea and I see its benefits. The main problem is that for my use, at least, I'm integrating the drawing into a LaTeX-typeset document, so there are a lot of concerns about the fonts (which I like customizing, away from the "Times" and the classical serif that LaTeX uses). Again, I cannot speak about professional publishers and editors and there may be a reason why InDesign + MathML or other plugins are industry standards. But I started the discussion completely from a personal point of view. At the present time, I would use LaTeXiT over any alternative any day. I use my own preambles and font preferences, mostly relying on built-in libraries and styles and I love it. I was mostly thinking about this kind of integration inside Affinity Designer. But yes, I do agree that I'm a niche user and maybe it would not make a lot of sense for the majority to have such a feature. Nevertheless, I'm happy to see some echo. As for a non-destructive graph plotting tool for Designer...man, that sounds like heaven! :) (although most likely not going to happen, given the main target and philosophy of the app) Thanks for the replies, great to read them! Share this post Link to post Share on other sites Hi Adrian_M et al, First of all, I would like to thank you for writing this feature request and add my vote to this request. I, too, am an user of Affinity Design for scientific purposes and I would really like to see the product become more accessible to academic publishing purposes. Now especially with Illustrator being a subscription-only service that is unaffordable for most academics, I think this product has a great market in the academic world! Secondly, Adrian_M mentioned that he is able to use LatexIt to perform drag-and-drop into the Affinity Design document. For some reason, I am having trouble doing the same thing. When I drag-and-drop, say the symbol \omega, into AFD document, it simply becomes an exclamation point (!). I am using a Macbook Pro (10.12.6). I am wondering if there is anything special I have to do to make LatexIt compatible with AFD in this case. Thanks! Ruby Share this post Link to post Share on other sites Dear Ruby Fu I totally agree! I've just bought Affinity Designer on the advice of a friend, and yes, it seems very nice, but.... ... I can't drag-and-drop PDF snippets generated by LaTeXiT. Same problem as you. This is very important as I need to label bits of the picture with same mathematical symbols as in the LaTeX document which I am writing. There isn't any trouble using LaTeXit and drag-and-drop with the competing Eazydraw software, but I would much prefer Affinity Designer if it can be made to work. I can also make LaTeXit work with Keynote, and it worked with my legacy copy of InDesign --- until I upgraded to macOS High Sierra, whereupon my InDesign CS4 stopped working, which is why I am looking for a new --- and affordable! --- graphics programme. I suspect the problem is that Affinity Designer wants to be able to edit what's inside the PDF snippet, and it can't. There's no need for it to do so, of course. Just moving it around, resizing, and rotating, would do very nicely. So please, Affinity people, when can we look forward to a fix? Best wishes Roman Share this post Link to post Share on other sites On ‎04‎/‎02‎/‎2017 at 2:44 PM, Peter Werner said: I've once typeset a booklet with mathematical formulas for students in Adobe InDesign for a client. While there are plugins like InMath, they are expensive and clumsy since they rely on hacks like baseline shifts and so on. There was another plugin that can be used an external formula editor like in Word, but it turned out the formulas didn't print properly and there were incorrect characters. Not to mention that these solutions are way too expensive if you only have a one-time project. Back then, I, too, found LaTeXIt! for Mac to be the best solution since it allows you to type out small snippets of LaTeX and save it out to a PDF using XeTeX (XeTeX being a key part since this allows access to OpenType fonts to customize the look to match the text in the publication) or copy and paste it into other applications. But it's not ideal since customizing the fonts, look and kerning of the formulas takes loads of boilerplate code since LaTeX was never meant for lots of customization. Not to mention every formula was basically a linked image and had to be re-built for even the smallest change. I don't think actual LaTeX integration would make a lot of sense. But I do think that built-in formula editing support for Affinity Publisher ("Maths Persona"?) would be a fantastic feature. Additionally, a way to quickly type LaTeX code simply as an input method (without having LaTeX installed, the formula subset would be enough) and a way to import MathML would make it really quick and flexible to create math-heavy documents. It's not just a feature that benefits the few people who are professionally printing math-heavy publications. I'm certain that such a feature would position Affinity Publisher as a really attractive solution for teachers and educators for creating work sheets and the like. This demographic is currently mostly on Word because something like InDesign is just way out of the price range and learning curve that these people would consider. But at$49, I think it would be a no-brainer for every teacher. All it would probably take is a decent math typesetting feature for Publisher and a non-destructive graph plotting tool for Designer. The expressions parser is already there as part of the text input fields…

Spot on Peter, I think you really hit the nail on the head there!

Share on other sites
On 19/12/2017 at 4:29 PM, Ruby Fu said:

Secondly, Adrian_M mentioned that he is able to use LatexIt to perform drag-and-drop into the Affinity Design document. For some reason, I am having trouble doing the same thing. When I drag-and-drop, say the symbol \omega, into AFD document, it simply becomes an exclamation point (!). I am using a Macbook Pro (10.12.6). I am wondering if there is anything special I have to do to make LatexIt compatible with AFD in this case.

Interesting thread I imagine this is due to our PDF import not handling fonts embedded in the PDF used for the exchange. If you can install them you will get better results. If you don't know which fonts are being used you could export the file to disk and ty to File > Open it in Designer, which will display the font substitution dialog.

Share on other sites

I've tried following your suggestions. After a couple of hours of looking around on the web I failed to find any fonts which helped. Perhaps they're the right fonts, but need renaming. I've also spend a couple of hours looking at various discussion sites, but it's all too technical for me.

So I think I'm going to have to give up. I thought a .pdf file was supposed to be portable in the sense that it contains all the information needed by software and hardware to produce an image. It works in other applications, so I think I'll have to use them instead.

Sorry to end on a negative note at this time of year.  Happy Xmas everyone!

Roman

Share on other sites
1 hour ago, RomanLZ said:

...

I thought a .pdf file was supposed to be portable in the sense that it contains all the information needed by software and hardware to produce an image.

Yes, Portable. But that doesn't mean Editable. PDFs were not ever made for opening to Edit. Some software can use the embedded fonts for editing. But that too doesn't mean wholesale editing. PDFs properly subset fonts. Which means that only characters used in a PDF can then be used for editing. Any typed characters that are not present in the PDF actually use a fallback character (a different font).

Mike

My computer is a nothing-special Toshiba laptop with unremarkable specs running Windows 10 64-bit.

Share on other sites

To my knowledge, there is a free TrueType version of LaTeX's Computer Modern typeface and its variations in existence, but I'm not sure if that would cover all the mathematical symbols and so on.

Adobe InDesign can import PDF as a vector picture format with pretty much perfect fidelity and will leave everything intact when printing since it's not attempting to bring it into its internal object model as an editable graphic. Illustrator on the other hand also has trouble when opening PDFs for editing and you'll never get perfect fidelity.

Since ads are usually supplied as print-ready PDFs in most professional publishing workflows, being able to place PDFs like any other image format and being able to rely on them being passed through to the final press ready PDFs virtually untouched, even if they contain embedded subsets of fonts that are not available on the system, or fonts that are installed in a different version on the host system, is actually a really important feature that I hope we are going to see in Affinity Publisher at some point. PDFs from LaTeXIt!, other scientific tools, or even specialized graphics/CAD software are obviously another use case.

Share on other sites
6 hours ago, MikeW said:

... Portable. But that doesn't mean Editable. PDFs were not ever made for opening to Edit. ..

Exactly right. I don't want or need to edit PDF files, I've already done that in LaTeX, which does mathematics brilliantly.

But if I want to do a picture, I also need to use a graphics program, and insert little PDF files containing the mathematical symbols.

If Affinity Designer insists on trying to open those little PDF files for editing, and fails, then I'm afraid I'll just have to use something else.

Roman

Share on other sites
Just now, RomanLZ said:

...

If Affinity Designer insists on trying to open those little PDF files for editing, and fails, then I'm afraid I'll just have to use something else.

Roman

Hi Roman,

The last version of Serif's PagePlus (now a dead) product was finally able to place PDFs as per QXP/ID/et al. It didn't work perfectly, especially as regards PDFs from InDesign (mainly due to certain types of transparency) but I suspect it would have done well with a LaTEX PDF as long as the fonts were properly embedded.

I would think that APub will obtain the ability to "place" PDFs versus just opening them as editable. If not the first version series, then later. It's pretty much a have-to type of thing for a layout application people will need to have play well with a broader application base.

Mike

My computer is a nothing-special Toshiba laptop with unremarkable specs running Windows 10 64-bit.

Share on other sites

The intersection of design (art) and mathematics is a small but highly active field. One particularly good example of art-meets-math is the app Processing. It‘s a code/math-to-art app. Creative arts aside, the field of scientific digital publishing does not yet have enough tools for the regular pro-user. We still have to resort to a lot of hacks and combinations of tools with some pretty ugly workflows.

@Adrian_M, like you I design a lot of figures and images for print and the web that need properly typeset mathematics. I usually want consistent typography. So, if the body text of a document is Cambria (from Microsoft Word), then I want my figures to use Cambria Math for labels and annotations.

To get all the mathematical and scientific characters in Unicode, I use Cambria Math when I’m preparing documents in Word and STIX 2 Text/Math when outside the Office suite. You can extract Cambria and Cambria Math from where they’re buried in the Word app to use them elsewhere. Besides Computer Modern, which I don’t usually use, I don’t know of any other good fonts for this range of Unicode. At least Affinity Designer supports this range of characters in Unicode. Gravit Designer doesn’t.

Ipe is a small and not-so-easy-to-use app that I use to create most of my mathematical figures and graphs. But it requires TeX installed separately and uses Computer Modern font. I haven’t figured out how to get TeX to use STIX 2 Math or Cambria Math yet.

You can put .EPS files from Ipe in Affinity Designer. But everything, equations included, is imported as curves so you can’t do any further text editing. This is the newest hack I’ve discovered which might come in useful soon. Unfortunately, Gravit Designer can’t import .EPS from Ipe and although it can import .PDF from Ipe the text/equations get messed up.

When I write for the web (blogs, online course books), I write in Markdown. I try to use SVG for figures but sometimes export figures as PDF (for crisp printing) or PNG (for accurate exporting). I write mathematics in LaTeX with the standard  delimiters, and when it’s published on the internet MathJax or KaTeX handle the rendering of the mathematics. But when I make documents and posters for school or to share on the web, I still use Microsoft Word and a combination of drawing apps. It is hard to get consistency across my products and my work flow is not pleasant.

I just got back into Affinity after a detour with Gravit Designer. Gravit Designer is fully web-based (built on Electron), so there’s no reason why they can’t add MathJax or KaTeX into the core app. But as someone here already said, makers of design apps are not going to make typesetting mathematics a priority. We are not the type of users who these apps are made for. The devs at Gravit Designer said exactly that to me and suggested I write a plugin. I wish I could but my JavaScript skills fall short at the moment.

@Macoun University students are indeed using some of the bigger mathematical packages out there. School students are using Desmos and GeoGebra these days. The problem with all of these apps is that they are made for “doing” mathematics, not preparing mathematics for publishing, or at least not for high school level of publishing or posters, where figures need to be a lot simpler but still technically correct. They are great for exploring and visualising mathematics but you have limited control over design and presentation. Academic publications will accept image output formats from the bigger apps, but those apps do not give much design control and you have to learn a lot of ugly syntax. Also, some of them are quite expensive.

As I understand it, Affinity Designer is developed in Xcode/Swift. I am teaching myself Swift and Xcode but I haven’t gotten far enough to know what a best solution for mathematical typesetting

would be in such an app. As I said, in Gravit Designer it’s easy—LaTeX with a MathML renderer (MathJax or KaTeX).

Well, that’s about everything I can contribute to this discussion. I’m liking Affinity Designer but I’m still hacking my way around different apps to produce the stuff I need/want to make.

Share on other sites
On 23/12/2017 at 6:04 AM, RomanLZ said:

Exactly right. I don't want or need to edit PDF files, I've already done that in LaTeX, which does mathematics brilliantly.

But if I want to do a picture, I also need to use a graphics program, and insert little PDF files containing the mathematical symbols.

If Affinity Designer insists on trying to open those little PDF files for editing, and fails, then I'm afraid I'll just have to use something else.

Roman

If you export .EPS from Ipe, you can File > Place… it in Affinity Designer.

See attached screenshot.

Since you already have have TeX, you can install and use Ipe. Also get the graph ipelet (plugin) for plotting functions.

My current TeX/LaTeX/Ipe setup doesn’t let me use other TeX math packages, but there’s probably a way to set that up and it seems you already have tools for getting the LaTeX that you want into PDF. So, just try exporting to .EPS from whatever you’re using. Then you can drop it in Affinity.

Share on other sites

What about VIsual Math Editor? I used it last year for a job, and the tool exports SVG, which can be directly imported in any design app. Including Gravit, Designer, PhotoLine, Inkscape, etc..

Share on other sites

@Medical Officer Bones Good tool that!

I don’t currently use Visual Math Editor in any of my work flows so I hadn’t tested it. It renders equations in the browser using MathJax and exports equations as MathML, PDF or SVG. Of those three, you can only File > Place… the SVG files into Affinity Designer. As with .EPS files, the SVG file gets placed as a group of individual curves for each character, which might come in handy. You could apply different colours and styles to different parts of the equation. As with the other methods we have so far, you don’t have any control over the font/typeface. Worth noting that MathJax uses a range of fonts, including STIX General.

Share on other sites

I did a bit of research, and I found a solution for the lack of control over the typeface.

(no need to install: unzip as a folder, and run the EXE)

Either use Visual Math Editor to save your work as MathML, and open in that editor, or create your formulas in Formulator (which is surprisingly easy to use). Then export as a PDF, and load that up in your design software. All the text objects remain text! Select these items and apply different typefaces.

I had tested this a few months ago with Visual Math Editor, but those PDF files wouldn't work properly for some reason. But the ones generated in Formulator do work.

Even better, Formulator supports any type family to be applied as well. Select the entire formula (or parts of it), and choose Style-->Other. Any typeface that includes all math symbols will work.

Wish I'd found this one last time.

*edit* Even the SVG output of Formulator retains text as text elements. Pretty impressive.

Share on other sites

Hello,

Is this feature request still being considered?

I would highly support adding this feature as I do scientific illustrations for academic publications and need a lot of Math equations to make using LaTeX.