Pages:
1
2 |
Diachrynic
Hazard to Others
Posts: 226
Registered: 23-9-2017
Location: western spiral arm of the galaxy
Member Is Offline
Mood: zenosyne
|
|
Make chemistry equations look different with Unicode
I made a small program (23 KB) to make chemical equations somewhat look better.
It turns this:
2MnO4 - + SO3 2- + 2OH- --> 2MnO4 2- + SO4 2- + H2O
into this:
2MnO₄⁻ + SO₃²⁻ + 2OH⁻ → 2MnO₄²⁻ + SO₄²⁻ + H₂O
by using a bunch of RegEx and Unicode. (Had to increase size a bit 'cause it was kind of small.)
If anyone wants to try it out, here is a download link: http://www.mediafire.com/file/aesa60r6c2w4e41/ChemistryInlin... (Just in case if the upload here does not work.)
If anyone wants to extend it, here is the important part of the source code (language is VB):
Code: |
Private Sub Convert()
Dim Str1 As String = TextBox1.Text
Str1 = " " + Str1.TrimEnd(" ")
Str1 = Regex.Replace(Str1, "[<]+[-‒–—―=]*[>]+", "↔")
Str1 = Regex.Replace(Str1, "[-‒–—―=]*[>]+", "→")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)0(?!\d*[+-]+)", "₀")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)1(?!\d*[+-]+)", "₁")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)2(?!\d*[+-]+)", "₂")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)3(?!\d*[+-]+)", "₃")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)4(?!\d*[+-]+)", "₄")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)5(?!\d*[+-]+)", "₅")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)6(?!\d*[+-]+)", "₆")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)7(?!\d*[+-]+)", "₇")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)8(?!\d*[+-]+)", "₈")
Str1 = Regex.Replace(Str1, "(?<!\s\d*)9(?!\d*[+-]+)", "₉")
Str1 = Regex.Replace(Str1, "((?<=\s\d+)[+]|(?<=\s)[+](?=\s*[+-]+)|(?<=\s+)[+]$|(?<=[A-Za-z])[+])", "⁺")
Str1 = Regex.Replace(Str1, "((?<=\s\d+)[-]|(?<=\s)[-](?=\s*[+-]+)|(?<=\s+)[-]$|(?<=[A-Za-z])[-])", "⁻")
Str1 = Regex.Replace(Str1, "\s+0(?=[⁺⁻]+)", "⁰")
Str1 = Regex.Replace(Str1, "\s+1(?=[⁺⁻]+)", "¹")
Str1 = Regex.Replace(Str1, "\s+2(?=[⁺⁻]+)", "²")
Str1 = Regex.Replace(Str1, "\s+3(?=[⁺⁻]+)", "³")
Str1 = Regex.Replace(Str1, "\s+4(?=[⁺⁻]+)", "⁴")
Str1 = Regex.Replace(Str1, "\s+5(?=[⁺⁻]+)", "⁵")
Str1 = Regex.Replace(Str1, "\s+6(?=[⁺⁻]+)", "⁶")
Str1 = Regex.Replace(Str1, "\s+7(?=[⁺⁻]+)", "⁷")
Str1 = Regex.Replace(Str1, "\s+8(?=[⁺⁻]+)", "⁸")
Str1 = Regex.Replace(Str1, "\s+9(?=[⁺⁻]+)", "⁹")
Str1 = Regex.Replace(Str1, "\s+(?=[₀₁₂₃₄₅₆₇₈₉]*[⁺⁻])", "")
TextBox2.Text = Str1.TrimStart(" ")
End Sub
|
To anyone better in programming this probably looks horrible
Have fun!
Cheers
Attachment: ChemistryInlineFormula.exe (23kB) This file has been downloaded 1513 times
we apologize for the inconvenience
|
|
VSEPR_VOID
National Hazard
Posts: 719
Registered: 1-9-2017
Member Is Offline
Mood: Fullerenes
|
|
$$2 \ \text{C}_6\text{H}_{12}\text{O}_6$$
test
[Edited on 17-5-2018 by VSEPR_VOID]
Within cells interlinked
Within cells interlinked
Within cells interlinked
|
|
MJ101
Hazard to Self
Posts: 82
Registered: 14-6-2018
Member Is Offline
Mood: Always Sunny
|
|
Hi,
I found this, which may also be of some use.
https://chemapps.stolaf.edu/jmol/jmol.php
I hope it's of some use to everyone.
https://chemapps.stolaf.edu/jmol/jmol.php?model=2595-97-3&am...
|
|
fusso
International Hazard
Posts: 1922
Registered: 23-6-2017
Location: 4 ∥ universes ahead of you
Member Is Offline
|
|
Quote: Originally posted by j_sum1 | Quote: Originally posted by chemrox | chemsketch requires registration and the word "mandatory" is anathema to moi. It just seems to me that limit notation is part of the history and
theory and is itself limited as has been mentioned. I guess I'm prejudiced because I use mostly partials. And rarely do physics. But I have explained
calculus using the concept of limits and have reminded myself how it all works by writing out the ideas with limit notation. |
A bit nonsequential, chemrox. It seems like you are answering several threads at once.
I downloaded and use chemsketch. No registration was required. This might be a recent change. Avogadro is similar but not as powerful.
Limit notation in calculus, or more accurately, analysis -- seems an ok way to write the concept. Or, more to the point, if you understand the
concept, the notation is pretty efficient. Beginning with the notation and then trying to insert the concept is a way to introduce confusions, but
that is a pedagogical issue and not unique to limits at all.
Liebniz notation does have advantages over function notation but I think I sumarised the position in the other thread. | The registration screen do occur to me
|
|
j_sum1
|
Thread Closed 10-10-2018 at 00:07 |
j_sum1
|
Thread Opened 10-10-2018 at 03:52 |
j_sum1
|
Thread Pruned 21-12-2018 at 21:04 |
j_sum1
|
Thread Pruned 30-12-2018 at 03:25 |
j_sum1
|
Thread Pruned 12-1-2019 at 15:04 |
Diachrynic
Hazard to Others
Posts: 226
Registered: 23-9-2017
Location: western spiral arm of the galaxy
Member Is Offline
Mood: zenosyne
|
|
Following up on my post from - what the shit pretty much exactly three years ago?! - I have improved the program into something far more practical.
Which one of these two looks better you'd say:
Cr2O7 2- + 2 OH- -> 2 CrO4 2- + H2O
Cr2O72- + 2 OH- → 2 CrO42- + H2O
Using the internal sub- and superscript button is a bit painful tho, especially because you get a dialogue box every time. I wrote an autohotkey
script that converts the top line to the bottom line with one key press.
Here is the code:
Code: | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^j::
temp = %clipboard%
SendInput, {Ctrl down}c{Ctrl up}
Sleep 10
Str1 = %clipboard%
Str1 := " " + RTrim(Str1, " ")
Str1 := RegExReplace(Str1, "[<]+[-‒–—―=]*[>]+", "↔")
Str1 := RegExReplace(Str1, "[-‒–—―=]*[>]+", "→")
Str1 := RegExReplace(Str1, "(?<![\s\d])(\d+)(?!\d*[+-]+)", "[sub]$1[/sub]")
Str1 := RegExReplace(Str1, "(?<=(\s|[A-Za-z]))(\d+[+-]|[+-](?=\s+[+↔→])|[+-]$)", "[sup]$2[/sup]")
Str1 := RegExReplace(Str1, "\s+(\[su[bp]\])", "$1")
Str1 := LTrim(Str1, " ")
clipboard := Str1
SendInput, {Ctrl down}v{Ctrl up}
Sleep 10
clipboard = %temp%
return |
nota bene: In the code I use the function Sleep 10 which was needed to slow down a bit, otherwise it would paste before it overwrote the old
clipboard. You might not need this, but it adds only 20 ms delay overall so I think it is acceptable.
If you have AHK already installed you just need to save this code as .ahk and run it. Currently the keybind is set to CTRL+J as denoted by the ^j:: in
the beginning, but you can change this to whatever you want. See this part of the AHK documentation for how other keys are encoded.
To use it, run the script, write an equation, select it, then hit the keybind associated with it. It will store your current clipboard, replace the
equation with the sub- and supercripted one and then restore your clipboard.
Hopefully this will be useful for some people!
we apologize for the inconvenience
|
|
SuperOxide
Hazard to Others
Posts: 486
Registered: 24-7-2019
Location: Devils Anus
Member Is Offline
|
|
I just saw this post, and thought ChemSketch may be nice to check out. I'm on OSX, and I looked to see if they had a .dmg I could install, and I saw
the phrase "Running ACD/Labs Software on Mac computers is not only possible, it's easy!" on their website, which lead me to
their tutorial video: How to Install Chemsketch and ACD/Labs Software on Mac (Demo).
The video literally walks you through downloading/installing an open source virtualization software, setting up a VM instance, installing and
configuring Windows 10 Home, and installing their software on that...
Ironic, that's the installation process I go through when something's not compatible with OSX too, lol.
|
|
j_sum1
Administrator
Posts: 6320
Registered: 4-10-2014
Location: At home
Member Is Offline
Mood: Most of the ducks are in a row
|
|
I have to admit to being a fan of Webmo.
I have used Chemsketch and also Avogadro. Chemsketch does not display multiple bonds well. Avogadro is cheap and nasty.
Webmo has a lovely phone app which is worth paying for the upgrade. There is also an online demo version that runs through your browser. Simply log
in as guest and you are treated to some lovely and quick to draw molecular modelling.
https://www.webmo.net/demoserver/cgi-bin/webmo/login.cgi
I should add that the phone app version calculates and animates molecule vibrations, which is lovely.
|
|
clearly_not_atara
International Hazard
Posts: 2786
Registered: 3-11-2013
Member Is Offline
Mood: Big
|
|
I haven't uploaded a whole lot of chemical drawings here, but I usually just use this website:
http://py-chemist.com/mol_2_chemfig/
Being a website, it works just as well on Windows, OS X and Linux. No registration required. You can even extract the PDF output and convert it to SVG
if you want to write Wikipedia articles. To do this, you might need to use Firefox; right click on the output image and under the "This Frame" menu,
choose "Show Only This Frame". But I have to draw my own arrows if I'm drawing reactions.
Somehow, I have been ignorant of $$\LaTeX$$ rendering here for a while, so thanks.
|
|
SuperOxide
Hazard to Others
Posts: 486
Registered: 24-7-2019
Location: Devils Anus
Member Is Offline
|
|
Quote: Originally posted by clearly_not_atara | I haven't uploaded a whole lot of chemical drawings here, but I usually just use this website:
http://py-chemist.com/mol_2_chemfig/
Being a website, it works just as well on Windows, OS X and Linux. No registration required. You can even extract the PDF output and convert it to SVG
if you want to write Wikipedia articles. To do this, you might need to use Firefox; right click on the output image and under the "This Frame" menu,
choose "Show Only This Frame". But I have to draw my own arrows if I'm drawing reactions. |
That's pretty neat - Bookmarked it for later.
A bit ago I use to use this thing I found (I think I saw it linked on a NileRed video, or maybe PoorMansChemist, forgot which). And it use to work pretty well, but not
some much anymore (the AJAX request keeps getting a 500 ISE error).
The Py-Chemist web app looks more powerful anyways, so that works out :-)
|
|
Colleen Ortiz
Harmless
Posts: 19
Registered: 16-12-2021
Member Is Offline
|
|
Re: Two FREE tools you probably didn't even know you had!
Hello,
LaTex is an amazing tool to use for all things. I like to use it, especially for documentation. LATEX is a document preparation system, not a word
processor, that allows you to create professional-looking documents. It excels in typesetting equations and is well-suited to producing long,
structured texts. It is available for most operating systems as free freeware.
If you're used to working with Microsoft Word to create documents, you'll notice that LATEX is a totally different way of working. 'What You See Is
What You Get' in Microsoft Word implies that you can see how the final product will look. As you type, the document will appear. When you operate in
this manner, you will most likely make modifications to the document's look (e.g., line spacing, font size, etc.) as you type (headings, page breaks,
etc.) With LATEX, you can't see how the final product will look. The document will appear as you type it, allowing you to concentrate. Rather than
focusing on the look, focus on the content. A plain text file with the extension.tex is a LATEX document. It may be entered in a simple text editor
like Notepad, but most users find that using a dedicated LATEX editor is more convenient.
|
|
Texium
|
Thread Moved 28-2-2023 at 08:25 |
Pages:
1
2 |
|