Coder Social home page Coder Social logo

Comments (11)

jxxcarlson avatar jxxcarlson commented on July 30, 2024

Resolved by 0b7cd88

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

Thank you!

from asciidoctor-latex.

jxxcarlson avatar jxxcarlson commented on July 30, 2024

I updated the gem to account for #44. Please let me know if you
encounter any problems with #44. The project as a whole needs
quite a bit of work.

Jim

On Jun 27, 2016, at 9:47 PM, Yacine Hmito [email protected] wrote:

Thank you!


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #44 (comment), or mute the thread https://github.com/notifications/unsubscribe/AApgNzKGbVgUJ_gY0swxNvRHjoiq1g9Lks5qQCi2gaJpZM4I_U-K.

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

When using macros.tex I now encounter the following error:

asciidoctor: ERROR: test.adoc: line 1: only book doctypes can contain level 0 sections

This does not happen if there are no macros.tex file.
This happens regardless of the backend used.
This happens even when macros.tex is empty.

However this does not prevent the document from being properly processed.

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

I think I found out why this happens.

The module lib/asciidoctor/latex/macro_insert.rb prepends a passthrough block to the document.
But this block appears before the title, hence the error.
This is without grave consequences for the HTML backend but it adds junks to the .tex file with the latex backend.

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

Final words: By inspecting the commit 0b7cd88, I concluded that I missed the actually bug because of the omission of the undocumented include_macros attribute.
By using it, it would have indeed added the div to the HTML backend, and only the HTML backend.

Two problems would be remaining:

. Macros would be included in the tex file regardless of the include_macros attribute
. The innocent error message above would be printed when using the HTML backend

This is of course what would have happened if I used include_macros with a version prior to the 0b7cd88 commit.

In light of this, I think the final fix would be to directly inject the div into the HTML tree in place of the MacroInsert processor. I don't know if or how this is feasible though. I'll be happy to hack a solution if I ever find time to dig into it.

from asciidoctor-latex.

jxxcarlson avatar jxxcarlson commented on July 30, 2024

Very good analysis! I think your proposal is the right one. This probably requires a tree processor -- something I have not used yet. If you find a solution, please let me know. In the meantime, I will look into it also.

from asciidoctor-latex.

jxxcarlson avatar jxxcarlson commented on July 30, 2024

I'm going to try a different strategy by introducing a block macro that works like this:

include_latex::macros.tex[]

with the general form

include_latex::PATH_TO_MACRO_FILE[]

I should have this ready shortly. If it works, I will remove the automatic inclusion of macros.tex

from asciidoctor-latex.

jxxcarlson avatar jxxcarlson commented on July 30, 2024

I've made the following changes:

(1) Eliminate automatic inclusion of macros.tex if it is present.
(2) Introduce the block macro include_latex_macros::LATEX_FILE, where LATEX_FILE is
typically a LaTeX style or macro file, or a path thereto. For the HTML backend, the file is included
in the source text as \( FILE CONTENTS \). For the tex backend it is included as-is.

If you find that this change works for you, you can close this issue. I very much appreciate your contributions to this project!

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

Thank you, this makes me feel very welcome.

I like the solution as it can also serve a wider range of use-cases.

From the quick tests I did, this seems to work, although there still are some irrelevant warnings. I'll give you more details when I'll find how to use the development version on my main computer (I have some trouble with gem paths unrelated to asciidoctor-latex). I expect this to be solved in less than 24 hours. I'll close the issue if it is not done before.

from asciidoctor-latex.

yacinehmito avatar yacinehmito commented on July 30, 2024

This works like a charm!

Note that, because macros are inserted in the text, you cannot use this new feature as a drop-in replacement for the macros.tex inclusion. Indeed macros were previously added in the preamble, which allowed the use of "preamble-only" macros (such as \DeclareMathOperator).

This is not a problem though. Such macros can be included with preamble.tex for the latex backend and docinfo.html for the html backend (macros included in the header work, at least on recent versions of Chromium).

from asciidoctor-latex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.