You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found the extra line below OrgToCharImage is caused by the frame wrap. If the wrap is "none", there will be an empty line. #191
To remove the empty line, the wrap has to be set to "after". Then in the case of image and caption have different width (eg. :width (5 . 10)), the caption will be put on the same line as the image, to avoid that, the caption need to be put in a separate paragraph.
I think generally the user doesn't need OrgToCharImage, unless he/she wants some text on image frame.
I have changed org-odt--render-image a little bit (lines wrapped between long ;;;;; lines). Maybe put caption into a separate paragraph should be the default option.
(defun org-odt--render-image (app cfg-key href
captions-plist
inner-frame-params
outer-frame-params)
(let* ((libreofficep (pcase app
("lo" t)
(_ nil)))
(caption (plist-get captions-plist :caption))
(_short-caption (plist-get captions-plist :short-caption))
(caption-position (plist-get captions-plist :caption-position))
(label (plist-get captions-plist :label))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(inner-frame-cfg-alist
`(("As-CharImage" :style "OrgInlineImage" :extra nil :anchor "as-char")
("CaptionedAs-CharImage" :style "OrgDisplayImage" :extra nil :anchor "paragraph")
("ParagraphImage" :style "OrgDisplayImage" :extra nil :anchor "paragraph")
("CaptionedParagraphImage" :style "OrgDisplayImage" :extra nil :anchor "paragraph")
("To-CharImage" :style "OrgImageCaptionFrame" :extra nil :anchor "as-char")
("CaptionedTo-CharImage" :style ,(cl-case caption-position
(above "OrgToCharImageCaptionAbove")
(below "OrgImageCaptionFrame"))
:extra nil :anchor "as-char")
("PageImage" :style "OrgPageImage" :extra nil :anchor "page")
("CaptionedPageImage" :style "OrgDisplayImage" :extra nil :anchor "paragraph")))
(outer-frame-cfg-alist
'(("CaptionedAs-CharImage" :style "OrgInlineImage" :extra nil :anchor "as-char")
("CaptionedParagraphImage" :style "OrgImageCaptionFrame" :extra nil :anchor "paragraph")
("CaptionedTo-CharImage" :style "OrgImageCaptionFrame" :extra nil :anchor "as-char")
("CaptionedPageImage" :style "OrgPageImageCaptionFrame" :extra nil :anchor "page")))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Retrieve inner and outer frame params, from configuration.
(inner (cdr (assoc-string cfg-key inner-frame-cfg-alist t)))
(outer (cdr (assoc-string cfg-key outer-frame-cfg-alist t)))
;; User-specified frame params (from #+ATTR_ODT spec)
(inner-user inner-frame-params)
(outer-user outer-frame-params))
(cond
;; Case 1: Image/Formula has no caption.
;; There is only one frame, one that surrounds the image
;; or formula.
((and (null caption) (null label))
;; Merge user frame params with that from configuration.
(setq inner (org-combine-plists inner inner-user))
(apply 'org-odt--draw:frame href inner))
;; Case 2: Image/Formula is captioned or labeled.
;; There are two frames: The inner one surrounds the
;; image or formula. The outer one contains the
;; caption/sequence number.
(t
;; Merge user frame params with outer frame params.
(setq outer (org-combine-plists outer outer-user))
;; Short caption, if specified, goes as part of inner frame.
(setq inner (org-combine-plists inner inner-user))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(let* ((text-frame (concat (apply 'org-odt--draw:frame href inner)))
(text-caption (plist-get captions-plist :caption-text)))
(cond
(libreofficep (apply 'org-odt--textbox
(concat
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
(concat
(when (plist-get captions-plist :subentityp) "Sub")
(plist-get captions-plist :caption-style))
text-frame)
(format "\n<text:p text:style-name=\"%s\">%s</text:p>"
(concat
(when (plist-get captions-plist :subentityp) "Sub")
(plist-get captions-plist :caption-style))
text-caption))
outer))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(t text)))))))
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have found the extra line below OrgToCharImage is caused by the frame wrap. If the wrap is "none", there will be an empty line. #191
To remove the empty line, the wrap has to be set to "after". Then in the case of image and caption have different width (eg. :width (5 . 10)), the caption will be put on the same line as the image, to avoid that, the caption need to be put in a separate paragraph.
I think generally the user doesn't need OrgToCharImage, unless he/she wants some text on image frame.
I have changed org-odt--render-image a little bit (lines wrapped between long ;;;;; lines). Maybe put caption into a separate paragraph should be the default option.
Beta Was this translation helpful? Give feedback.
All reactions