Login  Register

How to center image caption when the image is centered

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

How to center image caption when the image is centered

littlepanda
Hello,

While it is very easy to center the image, I couldn't find a way to center the caption text (except by changing the generated css). Am I overlooking something?

Thanks.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

mojavelinux
Administrator
@littlepanda,

That's a limitation of the default stylesheet (and stylesheet factory) at the moment. Ideally, the caption should either center with the image or left align to the left edge of the centered image. Both would require updates to the stylesheet.

Those changes can be made directly to the stylesheet [1] or you can include overrides in a docinfo file [2].

Btw, we are looking for design advice on the stylesheet in general. I'm close to the limit of my ability to make it look professional.

Cheers,

-Dan

[1] https://github.com/asciidoctor/asciidoctor-stylesheet-factory/blob/master/sass/components/_asciidoc.scss#L889-L910
[2] http://asciidoctor.org/docs/user-manual/#docinfo-file



On Tue, Oct 29, 2013 at 5:19 AM, littlepanda [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

While it is very easy to center the image, I couldn't find a way to center the caption text (except by changing the generated css). Am I overlooking something?

Thanks.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/How-to-center-image-caption-when-the-image-is-centered-tp901.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

littlepanda
@mojavelinux

Thank you for the info. We have to use our own stylesheet anyway, so docinfo file suits my needs.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

mikeosbornma
Does anyone have an example of a docinfo file that will center figure and/or table captions?

Thanks,

-Mike
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

ayca1903
In reply to this post by littlepanda
How can you do that? I didnt understand from the links.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

mojavelinux
Administrator
Please see https://github.com/asciidoctor/asciidoctor/issues/857 for a longer discussion on this issue.

-Dan

On Mon, Feb 29, 2016 at 6:45 AM, ayca1903 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
How can you do that? I didnt understand from the links.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/How-to-center-image-caption-when-the-image-is-centered-tp901p4438.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

ayca1903
you have said, It would be necessary to add the following declaration in the stylesheet (shown here in scss syntax)....

I dont know about the stylesheet, where is it, or how can I add the declaration to it?

I wrote like this,

[.text-center]
.Image Title
image::tiger.png[]

or

[.center.text-center]
.Diagram Example
image::diagram.png[]

or

.Diagram Example
image::diagram.png[align=center, title-align=center]

like this. I couldnt align the title.
Ted
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

Ted
ayca1903 wrote
I dont know about the stylesheet, where is it, or how can I add the declaration to it?
Start with your nameofdoc.adoc file in a directory with the images and add a docinfo.html file like this:

nameofdoc.adoc
docinfo.html
tiger.png
diagram.png

Add :docinfo1: to nameofdoc.adoc like this

= Centering
:docinfo1:

== Test Centering Below

[.text-center]
.Image Title
image::tiger.png[]

or

[.center.text-center]
.Diagram Example
image::diagram.png[]

or

.Diagram Example
image::diagram.png[align=center, title-align=center]


Finally in the docinfo.html file place this code

<style type="text/css"> .imageblock > .title { text-align: center; } </style>


Then render it with Asciidoctor

> asciidoctor nameofdoc.adoc

View nameofdoc.html for results.
- Ted @TedAtCIS
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

fsfarimani
I tried these solutions, none rendered properly on Atom live preview.
Ted
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: How to center image caption when the image is centered

Ted
fsfarimani wrote
I tried these solutions, none rendered properly on Atom live preview.
I haven't used the Atom editor in a while, but I'd bet there is not anyway to have it process the docinfo.html file and render that with the AsciiDoc file. Which is why you will not see the results in the Atom live previewer.

Use Asciidoctor to render the two files together to see the results.
- Ted @TedAtCIS