emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to center an image directly in org-mode (without exporting)
@ 2022-11-03 15:32 Cletip Cletip
  2022-11-04  4:54 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Cletip Cletip @ 2022-11-03 15:32 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

Hello to all,

My problem is quite simple to understand: when I activate
"org-toggle-inline-images", I would like my images to be centered. Indeed,
I tried this in a org-file

#+ATTR_ORG: :width 800 :center t

[[file:images/anImage.png]]


But it obviously doesn't work.

Does anyone have a tip?

(I'm thinking of creating a function that, each time the size of the window
changes, readjusts the number of spaces to put so that my image is
centered. It's not a very clean solution, but could it work?)

Thanks in advance

[-- Attachment #2: Type: text/html, Size: 3898 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to center an image directly in org-mode (without exporting)
  2022-11-03 15:32 How to center an image directly in org-mode (without exporting) Cletip Cletip
@ 2022-11-04  4:54 ` Ihor Radchenko
  2022-11-04 14:03   ` Cletip Cletip
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2022-11-04  4:54 UTC (permalink / raw)
  To: Cletip Cletip; +Cc: Org Mode List

Cletip Cletip <clement020302@gmail.com> writes:

> My problem is quite simple to understand: when I activate
> "org-toggle-inline-images", I would like my images to be centered. Indeed,
> I tried this in a org-file
>
> #+ATTR_ORG: :width 800 :center t
>
> [[file:images/anImage.png]]
>
>
> But it obviously doesn't work.

AFAIK, there is no easy way to do this, especially if you want the
centering to be preserved on resize.

> Does anyone have a tip?
>
> (I'm thinking of creating a function that, each time the size of the window
> changes, readjusts the number of spaces to put so that my image is
> centered. It's not a very clean solution, but could it work?)

What you are thinking is probably the only sane way. Though you do not
have to insert actual spaces. May instead use display property. See
40.16.3 Pixel Specification for Spaces section of Elisp manual.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to center an image directly in org-mode (without exporting)
  2022-11-04  4:54 ` Ihor Radchenko
@ 2022-11-04 14:03   ` Cletip Cletip
  0 siblings, 0 replies; 3+ messages in thread
From: Cletip Cletip @ 2022-11-04 14:03 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

Thanks you for your answer,
thanks for the tips, I will see that in detail.

Le ven. 4 nov. 2022 à 05:53, Ihor Radchenko <yantar92@posteo.net> a écrit :

> Cletip Cletip <clement020302@gmail.com> writes:
>
> > My problem is quite simple to understand: when I activate
> > "org-toggle-inline-images", I would like my images to be centered.
> Indeed,
> > I tried this in a org-file
> >
> > #+ATTR_ORG: :width 800 :center t
> >
> > [[file:images/anImage.png]]
> >
> >
> > But it obviously doesn't work.
>
> AFAIK, there is no easy way to do this, especially if you want the
> centering to be preserved on resize.
>
> > Does anyone have a tip?
> >
> > (I'm thinking of creating a function that, each time the size of the
> window
> > changes, readjusts the number of spaces to put so that my image is
> > centered. It's not a very clean solution, but could it work?)
>
> What you are thinking is probably the only sane way. Though you do not
> have to insert actual spaces. May instead use display property. See
> 40.16.3 Pixel Specification for Spaces section of Elisp manual.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>

[-- Attachment #2: Type: text/html, Size: 2071 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-04 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 15:32 How to center an image directly in org-mode (without exporting) Cletip Cletip
2022-11-04  4:54 ` Ihor Radchenko
2022-11-04 14:03   ` Cletip Cletip

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).