4
$\begingroup$

What would be an appropriate way to attach non-essential information to the post that is only visible when needed/requested and doesn't get in way or distract the reader?

My use-case is an urge to share LaTeX code which I use to generate graphics so that labels on the graphics match the default font used by MathJax. This refers mostly to chemical structures and diagrams. For example, I took a liberty to draw the diagram for Chemical kinetics for cyclic reversible reaction, and I'm left with the following LaTeX code which might be used for further question editing or be repurposed by the third party:

\documentclass{article}
\usepackage{chemfig}
\begin{document}

\schemestart
A
\arrow(A--C){<=>[$k_{-3}$][$k_{3}$]}[-60,1.25,,]
C
\arrow(@A--B){<=>[${k_{-1}}$][${k_{1}}$]}[-120,1.25,,]
B
\arrow(@B--@C){<=>[$k_{2}$][$k_{-2}$]}[,1.25,,]
\schemestop

\end{document}

In a sense, this code chunk is supplementary information, which is not needed for the majority of readers, but it probably would be nice to have the source code around. Multi-line comments on Stack Overflow is not really a solution. First, Chemistry.SE cannot execute code chunks, and especially not LaTeX code. Second, even formatted as comment or spoiler, it would still occupy space and would be a distraction.

To add an extra level of difficulty, how to deal with binary supplementary files? I remember orthocresol solved this elegantly by posting a profile link to own site or GitHub where the files and code were deposited. Can we do the same within the scope of SE, and what approach would be more legitimate and sensible?

$\endgroup$
7
  • $\begingroup$ I have two imperfect solutions (not worthy of an answer). You can attach a link to a picture (upload the picture, delete it and provide the link instead), or you can use a link to services like pastebin (not as rigorous as GitHub, but less setup). $\endgroup$
    – Karsten Mod
    Commented Oct 8, 2022 at 17:36
  • 1
    $\begingroup$ @Karsten The whole point is not to rely on other services, which can change their ToS, CoC,… or be taken down. SE using Imgur for images already makes me less comfortable, adding another point of failure is not quite what I have in mind. Think Google Stadia. I'm looking for an in-house solution — after all, adding several hidden text lines should not be this hard. $\endgroup$
    – andselisk Mod
    Commented Oct 8, 2022 at 18:36
  • 1
    $\begingroup$ I don't understand the question. You want the source code to an image, which is text, to be part of a text you post here? But it shouldn't be part of the post? I'm lost. Why is it no option to just include it here? If you just want something invisible, wrap it in comment tags... $\endgroup$ Commented Oct 8, 2022 at 20:28
  • $\begingroup$ @Martin-マーチン Source code should not be visible or get in way when one reads, and, ideally, edits the question. I tried HTML comment tags, and for some reason they don't always work properly with TeX code. Additionally, I'm looking for community's suggestion on how to append binary files like *.cdx. $\endgroup$
    – andselisk Mod
    Commented Oct 9, 2022 at 8:46
  • $\begingroup$ Hi @andselisk, could I get a little more insight to what exactly you're asking? I was thinking you're looking for hidden text that could be found when "editing" so it could be copy/pasted, but the comment above makes me think otherwise. Are you looking for some sort of SE Repository of "code" place? Sort of like the sandboxes I've used, but it's a lot of stored and reusable LaTeX? $\endgroup$
    – Avogadro StaffMod
    Commented Oct 26, 2022 at 13:58
  • $\begingroup$ @Avogadro I asked about hidden comment in the first place because it seems like the most obvious solution based on existing capabilities of SE sites. If you are suggesting there is something like figshare for ESI type of content that you as a staff member see viable to implement, then yes, I probably should've gone for a wider formulation and maybe add feature-request tag along the lines. $\endgroup$
    – andselisk Mod
    Commented Oct 26, 2022 at 21:24
  • 1
    $\begingroup$ (My own person thoughts, not the company) I was in the Sandbox for awhile yesterday and today trying to find a good work around for this. It seems to me there is a plugin for LaTeX, but the issue is we're using MathJax. I need to dig a little into this more. // As for some sort of storage mechanism for the ESI is a good question, I would say SO is good at Q&A, storage is another problem to solve, so it will take some thinking/investigation. I'll come back with some ideas. $\endgroup$
    – Avogadro StaffMod
    Commented Oct 26, 2022 at 21:52

2 Answers 2

3
$\begingroup$

The only other way I could find was to use LaTeX (well, MathJax) comments. This is perhaps not as pretty an answer as I had hoped for, and the source code cannot be directly copy-pasted, but it should be trivial to uncomment the lines in the user's preferred editor.

It does produce a small amount of whitespace, but if desired, the whitespace can be hidden at the end of a line like this: $ % \documentclass{article} % \usepackage{chemfig} % \begin{document} % % \schemestart % A % \arrow(A--C){<=>[$k_{-3}$][$k_{3}$]}[-60,1.25,,] % C % \arrow(@A--B){<=>[${k_{-1}}$][${k_{1}}$]}[-120,1.25,,] % B % \arrow(@B--@C){<=>[$k_{2}$][$k_{-2}$]}[,1.25,,] % \schemestop % % \end{document} $

$\endgroup$
1
  • $\begingroup$ That's what I'm planning to use for now, so… accepted:) Better a small fish than an empty dish. $\endgroup$
    – andselisk Mod
    Commented Oct 26, 2022 at 21:26
5
$\begingroup$

Using HTML comment tags <!-- ... -->, as Martin suggested, is one possibility (click edit to see an example).

However, on Stack Exchange, this seems to not work if the comment contains the greater-than symbol, >. See: > is closing HTML comments without a -​- delimiter

$\endgroup$
4
  • 2
    $\begingroup$ +1 for that P&P easter egg $\endgroup$ Commented Oct 8, 2022 at 22:35
  • 1
    $\begingroup$ HTML tags were the first thing I tried. Not sure why, but they don't work as expected for the LaTeX code in the question: i.sstatic.net/Xndpc.png. Sorry for turning the question into a troubleshooting, but HTML tags never worked reliably for me. There was always something junky about them, or maybe I'm too dumb to use them correctly. I don't mind the latter if only I knew what I do wrong. $\endgroup$
    – andselisk Mod
    Commented Oct 9, 2022 at 8:40
  • 1
    $\begingroup$ @andselisk Indeed, there is an issue with LaTeX code, which seems to be specifically caused by the presence of the > in <=> (removing it causes the enitre thing to be hidden as expected). I have no idea why, I looked up the HTML specification and it doesn't suggest any reason for that. $\endgroup$ Commented Oct 9, 2022 at 9:00
  • 2
    $\begingroup$ @andselisk meta.stackexchange.com/questions/120415/… $\endgroup$ Commented Oct 9, 2022 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .