modify katex output html/css? - mathjax

I've been pretty impressed with Katex's performance. It seems like a good fit as a rendering engine for a WYSIWIG latex editor. However, with MathJax, I can easily inject HTML/CSS in arbitrary locations using the \class directive. I can then use these injected classes for blinking cursors, gray boxes, and what not. For example:
Is there a way to do the same thing with Katex? In particular, I need the ability to inject HTML/CSS in arbitrary locations in the equation.

This is not currently supported. There is an open issue on the Github page.

Related

AvalonEdit: How to make it right-to-left?

I'm trying to make the avalonedit right-to-left layout, so that supporting languages that are right-to-left (e.g. Arabic)
The code seems to be too large to be understood, I need at least to know where my changes would be? What are main modules of it, or some diagrams/docs clarifying each component (other than the 4 images provided with the source)
I need at least to know what are the basic components of an editor. Thank you for help
The TextView class is responsible for the actual text rendering. The layout within text lines is done using the WPF TextFormatter (see #region BuildVisualLine in TextView.cs).
AvalonEdit already supports bidirectional text within a left-to-right paragraph, so the editor should work if you can get WPF to create right-to-left paragraphs.
I think it might be sufficient to change the VisualLineTextParagraphProperties.FlowDirection property.
Ideally the text view would use the value of TextView.FlowDirection for this, but I've seen some weird effects when using TextView.FlowDirection (text being mirrored). Not sure what's up with that; I'm not familiar with the way WPF works in a right-to-left context (I guess there's some auto-mirroring feature?).

Interacting with a SVG in Pharo?

I want to get a very basic interaction with a SVG loaded through Athens in Pharo using Morphic. This example shows what I'm looking for. I have used
(ASVGMorph fromFile: 'lion.svg') drawOn: Display getCanvas
but clicking the SVG makes the picture dissapear. However all examples I have seen were using a web browser. Is this possible using Athens? There is any other work in this area?
That's because you are drawing it in display canvas, which is refreshed every time... so is natural that you lost it...
What you need to do is:
(ASVGMorph fromFile: 'lion.svg') openInWorld.
or better, you probably want to put it in a window:
(ASVGMorph fromFile: 'lion.svg') openInWindow.
at the end, you will probably want it inside some other morph that you create, but debugging anyone of the solutions above with show you how to proceed :)
Yes, as Esteban pointed, to keep morph on desktop, you should add it to world, i.e. use
openInWorld, or #openInWindow.
ASVGMorph is very basic, however, and not intended to serve all possible use cases.
For more advanced uses, it is preferred to use ASVGRoot instance and draw it in own morph or compose with other drawings.

Organizing placemarks in Google Earth Plugin/KML

I am looking for some insight on if / how I can better approach creating my KML in order to make my data more readable when loaded by via a custom app developed around the Google Earth Plugin.
My constraints are:
I have no ability to do anything with the custom app or the plugin,
I can only provide KML files and take advantage of any features
built into the Google Earth Plugin.
The side bar where you select data to display does not list the folders of the selected KML as a sub menu like I have seen in Google Earth.
My data looks like:
Hundreds of Data points sometimes quite close together, which I am
currently displaying as placemarks, with no names set (was too noisy
on the map). I supply additional details on the placemark in the
description bubble / balloon.
Placemarks are frequently related to one another (i.e. there may be
4 placemarks representing a distinct group (e.g. coffee shops)).
What I have found so far:
There is no way for me to group pins as I zoom in and out without access to the JavaScript API / ability to do some amount of front end programming (i.e. there is no way to specify in the KML that pins should be grouped based on zoom level. I have noted the zoom level visibility settings which I do not believe accomplish what I am looking to do).
When clicking on a placemark there is no way to identify the other placemarks which are in the same group (i.e. all coffee shops) such as by changing their style (again note that to work for me this would have to be native functionality whose behaviour can be pre-specified in the KML). I hoped the plugin might provide some default functionality around this with folders, but I haven't been able to find anything.
My questions:
Are my above assumptions correct?
Are there some aspects of the KML spec and how it is displayed by google-earth which might be a good place for me to spend additional time understanding given the nature of my data?
Any suggestions or insight would be very welcome.
Edit: Also considered creating KML Tours to adjust visibility / identify related Placemarks, but could not see how I might start / stop the tour from a given Placemark (e.g. by clicking a link in the description balloon?).
Firstly, a question for you.
Are you wishing to load your 'app' on a mobile device? or are you just trying to do something on a normal computer?
I ask because you mention 'app' - yet in this line
I have no ability to do anything with the custom app or the plugin, I
can only provide KML files and take advantage of any features built
into the Google Earth Plugin.
The Google Earth PLUGIN is not support by mobile devices (yet) so if you can take advantage of it you must be talking about a normal computer scenario. So either a webpage, or a webpage embedded inside another program.
As for
There is no way for me to group pins as I zoom in and out without
access to the JavaScript API / ability to do some amount of front end
programming (i.e. there is no way to specify in the KML that pins
should be grouped based on zoom level. I have noted the zoom level
visibility settings which I do not believe accomplish what I am
looking to do).
Have you looked into using Regions ? With them you can control at what 'zoom' (ie what POV) a placemark becomes visible.
As for
When clicking on a placemark there is no way to identify the other
placemarks which are in the same group (i.e. all coffee shops) such as
by changing their style (again note that to work for me this would
have to be native functionality whose behaviour can be pre-specified
in the KML). I hoped the plugin might provide some default
functionality around this with folders, but I haven't been able to
find anything.
This depends of if you are really using the plug-in (and thus JS) or not. With straight KML I don't think anything is possible. However if you are using the plugin (and some JS) you have number of options depending on how you set up your .kml.
You can 'walk' through your kml file and find all placemarks with the same <style>
You can assign all your placemark id's by - and then using Accessors like this var placemark = ge.getElementById('unique_id');
However it sounds like you are not using JS so I am probably wasting time with this.
Same goes for using tours, IF you are using the plugin and IF you are willing to do some JS coding then YES you can use tours to all kinds of things.
However, if you are talking about a mobile device app, then nothing is possible (except the Regions) and I suggest you edit your question to remove the 'google-earth-plugin' tag.

Working arround font rendering issues in all major browsers

Since long time i been having a real problem with the different ways that each browser display text.
Sure you have noticed that even when you create a stylesheet specifying everything about the font properties, still every browser display the same text with some differences, the usual problem is the font weight, that even if you specify it different browsers display it different ways.
I would like to know if some as come with a solution. Not turning the text into a image.
Thanks.
EDIT:
This is a example of the problem. On the left Firefox and right IE. However i have defined in the CSS font family, weight, size and still they render the fonts different.
Snapshot
Do you mean that on one browser its bold and another one its normal? A reset should fix that, but if it doesn't, it might be something overriding that.
If you're talking about fonts looking different, it is possible - for example, since Google Chrome / Chromium sandboxes the renderer process, the font rendering won't be affected by other parts of the system, and I believe that it uses some sort of special font rendering. To be honest, on my Linux install, I do get bolder fonts on Chromium, but Firefox displays them fine.
There's SIFR (as pointed above), but it needs Flash and it is a bit heavy. There's also Cufon http://cufon.shoqolate.com/ that uses Javascript. Could you show a screencast so we know what's the problem? Thanks.
SIFR is a good solution, as long as you're only trying to control the appearance of small chunks of text (headings, design elements, etc.)
Beyond that, browsers are perfectly allowed to render text any way they want, and getting it pixel-perfect between browsers and operating systems is usually not even desirable for larger chunks of text. Users will have different accessibility settings and anti-aliasing settings which are tuned to the way they want to read text, and in general websites should try to respect that.
You can use SIFR.
Although this problem is already about a week old, here is a solution that I found, that might be related:
http://blog.wolffmyren.com/2009/05/28/jquery-fadeinfadeout-ie-cleartype-glitch/
If you're not using jQuery, try removing the filter attribute from the elements that are displaying non-Cleartype'd text and it should work, according to that blog post.

Anti-aliased font in HTML page

Is there a good way to create crisp, clear, LARGE font in webpages? I need to create a tag cloud effect on my homepage with different font sizes and colours.
I've got it set up in HTML/CSS but on the older browsers or OS's which don't support anti-aliasing as default it looks a bit... crappy.
I've played with sIFR, which worked beautifully but gave me some horrible load effects but I'm now wondering if there is a way to:
a) do browser/OS detection to split users by browser/OS combinations which I KNOW support anti-aliasing (they get raw HTML) and by "others" who get an image tag.
b) Some sort of JavaScript to add antialiasing?
c) Permanent solution to load a BG image in the div and hide the HTML text. (I know, I know, Google horror stories about de-indexing... but is it possible?)
a) Of course you can use browser detection. The easiest way to do this is probably using jQuery's browser method. (jQuery is an awesome JavaScript library that makes a lot of JS-development easier in case you haven't heard)
Depending on what browser (or OS) results you get, you could present the user with different solutions, from normal text to something like a Flash solution.
However, I advise against it. Things look better on new machines than old ones. That's just the way it is, which is why I recommend against spending precious time on minor glitches in older browsers. -- Unless users with older browsers are your main demographic of course. In this case, how about you just do it in Flash altogether? No use coding up two solutions if one always works, right?
b) You can in fact create anti-aliased text via JavaScript. Have a look at my project Die Stimme Gottes ("Voice of God" -- not for the religiously squeamish) for an example. In this project, I used the excellent typeface.js for this.
c) Just use CSS, maybe?
h1.welcome {
background: url('the-welcome-image.png') no-repeat;
color: transparent;
}
+1 Hank's comment. You have very little to gain by doing this. Some desktop browsers (including IE7+ and Safari) turn on anti-aliasing by default even when it's off at an OS level, and modern (post-XP) OSs tend to turn it on by default anyway. By forcing AA on the rest, you'll:
(+) improve the display a little for IE6 and XP+Firefox users who unwittingly don't have AA
(-) make loading slower for everyone (but especially users of limited mobile devices)
(-) defeat preferred font sizes
(-) unnecessarily annoy the luddites who deliberately disable anti-aliasing because it's “all blurry”(*)
(*: there are limited cases where this does even make sense, particularly for old, fuzzy CRT monitors.)
By the looks of it the best methods (in no real order) are:
1) Use an image. If you rely on SEO for the site then by all means add html and hide it using css using one of these methods
2) typeface.js - JS which will work across most modern browsers. Has some bugs and glitches but works nicely. If you're going to force anti-aliasing on your users then this works. Use sparingly. Author working on Opera and IE8 compatability though...
2) sIFR - Excellent script which dynamically replaces your selected areas of text with flash movies. Again some bugs and glitches, but if you're simply interested in awesome looking font then this is perfect. Increases your page load though, so as ever more is less, use sparingly.
I tend not to go with JS heavy solutions, as I like to have lightning quick page loads, but if you HAVE to have some good looking fonts, then these seem to be the most graceful and simple methods.
-webkit-font-smoothing:antialiased;
Force background color, redefining it for the class or element with the same background color. It works.
span.your_class {
writing-mode: tb-rl;
filter: flipv fliph;
background-color: #006cb8 !important;
}
Flash or Silverlight are your best bets for great looking font rendering

Resources