Skip to content
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

Invoking latex converter from elsewhere #102

Open
jxxcarlson opened this issue Oct 28, 2014 · 4 comments
Open

Invoking latex converter from elsewhere #102

jxxcarlson opened this issue Oct 28, 2014 · 4 comments

Comments

@jxxcarlson
Copy link
Contributor

Am trying to set things up so that I can invoke asciidoctor -r ./latex_converter.rb -b latex from
other than the directory /Users/carlson/Dropbox/prog/git/asciidoctor-backends/ruby/latex. This to facilitate giving the converter a real workout with real documents.

This works:

$ pwd
/Users/carlson/Dropbox/prog/git/asciidoctor-backends/ruby/latex
 $ asciidoctor -r ./latex_converter.rb -b latex test/sample1.adoc -o foo.tex

The below doesn't. Any suggestions?

 $ pwd
/Users/carlson/Dropbox/Beijing_2014/hodge/text
 $ export LTC=/Users/carlson/Dropbox/prog/git/asciidoctor-backends/latex_converter.rb
 $ echo $LTC
/Users/carlson/Dropbox/prog/git/asciidoctor-backends/latex_converter.rb
 $ asciidoctor -r $LTC -b latex 002-Algebraic_Varieties.ad -o foo.tex
asciidoctor: FAILED: '/Users/carlson/Dropbox/prog/git/asciidoctor-backends/latex_converter.rb' 
could not be loaded
@jirutka
Copy link
Member

jirutka commented Oct 28, 2014

Asciidoctor backends really should be packaged as Ruby gems, especially when it’s not just a set of templates, but contain some Ruby sources. Then this problem (with LOAD_PATH) would not occur. @mojavelinux has already mentioned it in #57 – we need some support in the Asciidoctor core for loading backends from gems. It shouldn’t be hard to implement it; I’d like to do that, but I’m currently pretty busy with refactoring of HTML5 templates, so maybe later.

@jxxcarlson
Copy link
Contributor Author

This, or some other convenient system would be great. I need a better installation to really exercise the latex backend.

One thing I need guidance on: I believe the preprocessor converts things like -- into html entity sequences like  —  -- LaTeX chokes on these. I would rather cut them off early rather than postprocess them out. (I will look at the preprocessor code, but any hints are welcome).

@jirutka
Copy link
Member

jirutka commented Oct 28, 2014

You can completely disable substitutions or allow just some subset, see docs here. Is it a suitable solution for this problem?

BTW, I can highly recommend to use XeLaTeX – it knows Unicode (no more cryptic escape codes), TrueType and OpenType fonts (use truly high quality fonts without conversions) and other features that everyone expects in the 21st century… 😼

@mojavelinux
Copy link
Member

It's time to graduate! See #107.

Asciidoctor backends really should be packaged as Ruby gems

There are two things to consider here.

First, we should package the backend templates so they can be used from the load path while in incubation (and for the reference templates). That would necessitate wiring the -T flag to the LOAD_PATH (we could use the Gem interface or a gem like hike).

For new converters like LaTeX, this repository serves as an incubator. Eventually, each dedicated converter should become it's own repository (much like -pdf and -epub3). Once the converter is published as a gem, it's possible to load it from the LOAD_PATH using the -r flag. Once we complete #107, publish asciidoctor-latex, and you install the asciidoctor-latex gem, you should be able to run:

asciidoctor -r asciidoctor-latex -b latex test/sample1.adoc

Thus, I think the resolution to this issue is to proceed with #107.

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

No branches or pull requests

3 participants