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

Boolean in LaTeX based on LaTeXML use? #900

Closed
wspr opened this Issue Dec 8, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@wspr

wspr commented Dec 8, 2017

This is (I think) a feature request, but I'm happy to look into the technical details if necessary. What I am after is something like

\documentclass{article}
\usepackage{latexml}% doesn't exist yet
\begin{document}
hello
\iflatexml
  this will only appear in a latexml-processed document
\fi
\end{document}

The motivation here is to do some small formatting tweaks based on PDF-via-LaTeX or HTML output mode. E.g., say, in PDF mode for href links I'd like to include a footnote of the URL, such as (again hypothetical)

\newcommand\LINK{2}{%
  \href{#1}{#2}%
  \iflatexml\else\footnote{\url{#1}}\fi
}

I think this would be fairly easy to add with a trivial .sty file that creates the \iflatexml boolean and sets it false, and then writing a binding file that does the same thing but sets the boolean true — but I wanted to check: (a) whether I'd missed something easier; (b) whether it fits the philosophy of LaTeXML in the first place.

If it makes sense to, I'd be happy to write the files necessary and contribute them to the repository. But I thought it would be wise to discuss first!

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Dec 8, 2017

Nice validation that we're thinking the same way here. In fact there is a latexml.sty that defines \iflatexml exactly as you wish (along with a bunch of other stuff with currently inconsistent naming schemes, and mostly undocumented. Also, it's not yet pushed to CTAN where it probably ought to be).

So, the question is why it didn't work; Old version or installation glitch? What version are you running?

As to philosophy, I think you have it exactly right; other than ideally LaTeXML would do the Right Thing so that you seldom have to resort to such things.

@wspr

This comment has been minimized.

wspr commented Dec 8, 2017

@brucemiller — oh wow, no, I hadn't seen latexml.sty at all, and it's pretty good we can up with the same boolean :) Oh, and the same url idea!

After writing up the message I also thought about situations where you might want to conditionally change (say) image paths depending on whether you're publishing HTML or typesetting to PDF.

I'll check out the package over the weekend or early next week and report back. Having the package in CTAN would certainly help — I would have found it if texdoc latexml had told me about it :)

Should we leave this issue as a reminder to create a package for CTAN? I'd be happy to write up a documentation file if that would help.

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Dec 8, 2017

As for urls & such, the hyperref package should be well supported.
As for documentation, I actually already have a nice proposed document in issue #844, that I need to do something with.

But really, before that or CTAN happens, I'm concerned about establishing a safe & sensible naming convention for LaTeXML "extensions". Mostly, I've just been using a prefix of \lx (or \lx@ for internal) which seems a short, typeable abbreviation of "latexml"... but also of "latex", duh! I couldn't quite get happy with longer \lxml or such. And I've been carefully avoiding the exp3 approach for the time being! :> Any advice?

@wspr

This comment has been minimized.

wspr commented Dec 8, 2017

Oh dear, naming is always the toughest problem. No worries about overlooking expl3 here — I don't think that's the right approach either.

I've just grepped through my entire CTAN folder for strings starting with \lx and have found basically nothing (and exactly nothing for \lx@). To be more precise:

/usr/local/texlive/2017//texmf-dist/tex/latex/actuarialsymbol/actuarialsymbol.sty:109:\DeclareRobustCommand{\lx}{\@actothersc {\ell}}
/usr/local/texlive/2017//texmf-dist/tex/latex/rubik/rubikcube.sty:585:\pgfmathsetmacro{\lx}{#1}%
...
/usr/local/texlive/2017//texmf-dist/doc/ptex/ptex-base/fam256d.tex:107:{\tt meaning of \verb|\lx|:\ \meaning\lx}
/usr/local/texlive/2017//texmf-dist/doc/ptex/ptex-base/fam256d.tex:110:${\tt \verb|\lx|:\ }\lx,\

So if you've been happily using \lx, I'd stick with it!

@brucemiller

This comment has been minimized.

Owner

brucemiller commented Dec 8, 2017

Woohoo! All the more reason to push to CTAN before somebody else gets wise! :>

@dginev dginev added the enhancement label Dec 8, 2017

@dginev dginev added this to the LaTeXML-0.8.4 milestone Dec 8, 2017

@wspr

This comment has been minimized.

wspr commented Dec 12, 2017

I just re-built LaTeXML from source and found that it installs latexml.sty in a sensible location; I think CTAN might not really be needed — the only thing would be to include a latexml.pdf file installed locally as well.

Thanks for the pointers and sorry I missed the package entirely the first time around... I'll close there here and we can continue discussion (if necessary) in #844.

@wspr wspr closed this Dec 12, 2017

@dginev dginev modified the milestones: LaTeXML-0.8.4, LaTeXML-0.8.3 Jan 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment