[small] not working with asciidoctr-pdf

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[small] not working with asciidoctr-pdf

amuza
Hi,

I'm new here. I have done my first pdf file with asciidoctor-pdf. It worked but not perfectly, words between [.small]# and # did not shrink in the pdf file.

Anyone knows why that could happen?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Hi, welcome to the forum.

I believe [small]#small text# is only supported in HTML output. It is not supported with asciidoctor-pdf.

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

amuza
Hey, thanks for answering!

And, is there any way I could use asciidoc to make some text smaller in a pdf?
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

amuza
And also colors!
I cannot see them in the pdf file.

Is there any way to make colors appear in the pdf file?
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Amuza,

As far as I am aware, you cannot change font size or colour on an arbitrary piece of text with asciidoctor-pdf.

I certainly hope that these sort of features will be implemented in the upcoming 2.x version of asciidoctor-pdf.

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

mojavelinux
Administrator
In fact, it is possible to make text smaller in Asciidoctor PDF. It's just not very pretty.

The word +++<font size=".5em">small</font>+++ is smaller than the rest of the line.

The issue that deals with inline roles is here: https://github.com/asciidoctor/asciidoctor-pdf/issues/368 (there are other issues as well). small is role, so it falls under this domain.

I don't have the bandwidth at the moment to address this. My focus right now is Asciidoctor 2.0.

Cheers,

-Dan

On Sun, Feb 10, 2019 at 4:17 AM 1marc1 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Amuza,

As far as I am aware, you cannot change font size or colour on an arbitrary piece of text with asciidoctor-pdf.

I certainly hope that these sort of features will be implemented in the upcoming 2.x version of asciidoctor-pdf.

Marc.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/small-not-working-with-asciidoctr-pdf-tp6702p6715.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Dan,

I wasn't aware of that possibility. I tried to extend it to colours, but the following does not work:

Attempt to provide +++<font color="#d3173c">some colour</font>+++ in a line of text.
Attempt to provide +++<font color=#d3173c>some colour</font>+++ in a line of text.

I also had a look at making life easier when working with changing font sizes, by doing this:

:smallfont: +++<font size=".5em">
:largefont: +++<font size="1.5em">
:endfont: </font>+++

The word {smallfont}small{endfont} is smaller than the rest of the line. 
The word {largefont}big{endfont} is bigger than the rest of the line.

Unfortunately, the above does not work.

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

mojavelinux
Administrator
If you want to understand what's possible and what's not with the inline pseudo-HTML, see this code:

https://github.com/asciidoctor/asciidoctor-pdf/blob/master/lib/asciidoctor-pdf/formatted_text/transform.rb#L118-L248

The font tag doesn't support color. But the color tag does.

Remember there's no actual HTML renderer here. We're doing all this with custom code.

-Dan

On Sun, Feb 10, 2019 at 2:55 PM 1marc1 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Dan,

I wasn't aware of that possibility. I tried to extend it to colours, but the following does not work:

Attempt to provide +++<font color="#d3173c">some colour</font>+++ in a line of text.
Attempt to provide +++<font color=#d3173c>some colour</font>+++ in a line of text.

I also had a look at making life easier when working with changing font sizes, by doing this:

:smallfont: +++<font size=".5em">
:largefont: +++<font size="1.5em">
:endfont: </font>+++

The word {smallfont}small{endfont} is smaller than the rest of the line. 
The word {largefont}big{endfont} is bigger than the rest of the line.

Unfortunately, the above does not work.

Marc.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/small-not-working-with-asciidoctr-pdf-tp6702p6717.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Dan,

Thank you for pointing this out. For reference, the following works:

Attempt to provide +++<color rgb="#d3173c">some colour</color>+++ in a line of text.

Unfortunately, the following does not work:

:my_red: #d3173c
Attempt to provide +++<color rgb=$my_red>some colour</color>+++ in a line of text.

Another question: is there a way to change the background color of text?

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Oops, silly me: attribute substitution works via {}. I was actually trying to pull a variable from my theme file...

:my_red: #d3173c
Attempt to provide +++<color rgb={my_red}>some colour</color>+++ in a line of text.
Attempt to provide +++<color rgb="{my_red}">some colour</color>+++ in a line of text.

Unfortunately, neither of the above works.

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

mojavelinux
Administrator
Marc,

If you want to use an attribute, then you have to switch to the inline pass macro:

:red: #ff0000

Attempt to provide pass:a[<color rgb="{red}">some colour</color>] in a line of text.

(The triple plus passthrough does not allow any substitutions).

-Dan

On Tue, Feb 12, 2019 at 1:48 AM 1marc1 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Oops, silly me: attribute substitution works via {}.

:my_red: #d3173c
Attempt to provide +++<color rgb={my_red}>some colour</color>+++ in a line of text.
Attempt to provide +++<color rgb="{my_red}">some colour</color>+++ in a line of text.

Unfortunately, neither of the above works.

Marc.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/small-not-working-with-asciidoctr-pdf-tp6702p6720.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

1marc1
Dan,

Great. Thank you for your reply. This is very helpful. I have been playing around with this and can confirm this also works inside tables:

:red: #ff0000

|===
|Column 1| Column 2
|row 1   | pass:a[<color rgb="{red}">row 1</color>]
|===

The drawback I can see is that this works for asciidoctor-pdf, but does not work for the HTML output. So, if I want to create a document that I want to turn into both a PDF and an HTML document, I essentially need to first create the PDF (with the above code), then update the code for my HTML output.

Is that correct? If so, is this something that will be addressed in the upcoming version 2.0? Is there any more news on 2.0?

Marc.
Reply | Threaded
Open this post in threaded view
|

Re: [small] not working with asciidoctr-pdf

mojavelinux
Administrator
Marc,

Yes, that is correct. It would be Asciidoctor PDF specific.

Asciidoctor 2.0 is in the process of rolling out. News will follow shortly thereafter about Asciidoctor PDF.

Cheers,

-Dan

On Tue, Feb 12, 2019 at 4:51 AM 1marc1 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Dan,

Great. Thank you for your reply. This is very helpful. I have been playing around with this and can confirm this also works inside tables:

:red: #ff0000

|===
|Column 1| Column 2
|row 1   | pass:a[<color rgb="{red}">row 1</color>]
|===

The drawback I can see is that this works for asciidoctor-pdf, but does not work for the HTML output. So, if I want to create a document that I want to turn into both a PDF and an HTML document, I essentially need to first create the PDF (with the above code), then update the code for my HTML output.

Is that correct? If so, is this something that will be addressed in the upcoming version 2.0? Is there any more news on 2.0?

Marc.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/small-not-working-with-asciidoctr-pdf-tp6702p6722.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux