emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Vertically aligning images in tables?
@ 2016-01-14 22:05 Peter Davis
  2016-01-15 12:16 ` Rasmus
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Peter Davis @ 2016-01-14 22:05 UTC (permalink / raw)
  To: emacs-orgmode


I'm trying to place three images side-by-side to they're top-aligned, but I can't see to find a way to get org-mode to do this. My
current code is:

+----
| #+MACRO: p  \includegraphics[scale=.3]{$1}
| #+ATTR_LATEX: :align {p{5cm} p{5cm} p{5cm}}
| | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
+----

As far as I can tell from LaTeX doc, the p attribute is supposed to top-align the contents, but it's not doing that.

Have I missed something?

Thanks,
-pd

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

* Re: Vertically aligning images in tables?
  2016-01-14 22:05 Vertically aligning images in tables? Peter Davis
@ 2016-01-15 12:16 ` Rasmus
  2016-01-15 16:44 ` Eric S Fraga
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Rasmus @ 2016-01-15 12:16 UTC (permalink / raw)
  To: emacs-orgmode

Peter Davis <pfd@pfdstudio.com> writes:

> Have I missed something?

Must it be a table? If not you might have missed the subcaption package.

    http://thread.gmane.org/gmane.emacs.orgmode/92820

Rasmus

-- 
Need more coffee. . .

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

* Re: Vertically aligning images in tables?
@ 2016-01-15 15:16 Peter Davis
  2016-01-15 17:13 ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Davis @ 2016-01-15 15:16 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Peter Davis <pfd@pfdstudio.com> writes:
>
>> Have I missed something?
>
> Must it be a table? If not you might have missed the subcaption package.
>
>     http://thread.gmane.org/gmane.emacs.orgmode/92820


Thank you, Rasmus.

This solution looks very specific to a particular problem. I'm not interested in captions at all. I just have 3 images, roughly the
same width by different heights, and I'd like to place them side by side, with the tops aligned. I doesn't have to be a table, but I
assume that would be the simplest way to do this (except I haven't made it work yet.)

Thanks,
-pd

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

* Re: Vertically aligning images in tables?
  2016-01-14 22:05 Vertically aligning images in tables? Peter Davis
  2016-01-15 12:16 ` Rasmus
@ 2016-01-15 16:44 ` Eric S Fraga
  2016-01-15 17:03 ` Eric S Fraga
  2016-01-15 17:10 ` John Hendy
  3 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2016-01-15 16:44 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Thursday, 14 Jan 2016 at 17:05, Peter Davis wrote:
> I'm trying to place three images side-by-side to they're top-aligned,
> but I can't see to find a way to get org-mode to do this. My
> current code is:
>
> +----
> | #+MACRO: p  \includegraphics[scale=.3]{$1}
> | #+ATTR_LATEX: :align {p{5cm} p{5cm} p{5cm}}
> | | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
> +----
>
> As far as I can tell from LaTeX doc, the p attribute is supposed to
> top-align the contents, but it's not doing that.

Yes and no... :-)

The p directive will top align in the sense that the first line of each
entry will be at the top of the vertical space provided for the row once
all columns in the row have been defined.  However, the images will be
bottom aligned on the baseline of the first line in that row and all the
columns will have the same baseline.  The height of the first line in
each paragraph will all be the same, equal to the maximum of the heights
of the first lines in all the columns.  Therefore, if the images have
different heights, they will not be aligned with respect to the tops of
the images.  

I hope this makes sense.

A solution is to use a parbox of the right (and equal) height for each
image.  Enclose the includegraphics within a parbox but you will have to
preset the height to use...  

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.3-449-gd85ff3

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

* Re: Vertically aligning images in tables?
  2016-01-14 22:05 Vertically aligning images in tables? Peter Davis
  2016-01-15 12:16 ` Rasmus
  2016-01-15 16:44 ` Eric S Fraga
@ 2016-01-15 17:03 ` Eric S Fraga
  2016-01-15 17:10 ` John Hendy
  3 siblings, 0 replies; 12+ messages in thread
From: Eric S Fraga @ 2016-01-15 17:03 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Thursday, 14 Jan 2016 at 17:05, Peter Davis wrote:
> I'm trying to place three images side-by-side to they're top-aligned,
> but I can't see to find a way to get org-mode to do this. My

Following up on my previous email, I couldn't resist...

A LaTeX hack that works is:

#+begin_src org
  ,* introduction
  ,#+latex: \newcommand{\boxedimage}[1]{\parbox[b][20pt][t]{1.5cm}{\includegraphics[scale=0.3]{#1}}}
  ,#+MACRO: p  \boxedimage{$1}
  ,#+ATTR_LATEX: :align ccc
  |------------------+------------------+--------------------|
  | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
  |------------------+------------------+--------------------|

#+end_src

I tried to have everything in the macro but org started escaping some of
the curly braces unfortunately...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.3-449-gd85ff3

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

* Re: Vertically aligning images in tables?
  2016-01-14 22:05 Vertically aligning images in tables? Peter Davis
                   ` (2 preceding siblings ...)
  2016-01-15 17:03 ` Eric S Fraga
@ 2016-01-15 17:10 ` John Hendy
  3 siblings, 0 replies; 12+ messages in thread
From: John Hendy @ 2016-01-15 17:10 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

Have you just googled for this? Honestly, I find StackOverflow (and
fam) much better than the mailing list for this sort of thing. Almost
any LaTeX question you can ask has already been asked. Try googling
"latex top align image tabular" and see if the first page of hits
(almost all latex.SE) gets you close. Org integration is another
thing, but at least you'll know definitively what you want to
implement in LaTeX.

John

On Thu, Jan 14, 2016 at 4:05 PM, Peter Davis <pfd@pfdstudio.com> wrote:
>
> I'm trying to place three images side-by-side to they're top-aligned, but I can't see to find a way to get org-mode to do this. My
> current code is:
>
> +----
> | #+MACRO: p  \includegraphics[scale=.3]{$1}
> | #+ATTR_LATEX: :align {p{5cm} p{5cm} p{5cm}}
> | | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
> +----
>
> As far as I can tell from LaTeX doc, the p attribute is supposed to top-align the contents, but it's not doing that.
>
> Have I missed something?
>
> Thanks,
> -pd
>

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

* Re: Vertically aligning images in tables?
  2016-01-15 15:16 Peter Davis
@ 2016-01-15 17:13 ` Rasmus
  2016-01-15 17:15   ` Rasmus
  0 siblings, 1 reply; 12+ messages in thread
From: Rasmus @ 2016-01-15 17:13 UTC (permalink / raw)
  To: pfd; +Cc: emacs-orgmode

Hi Peter,

Peter Davis <pfd@pfdstudio.com> writes:

>>     http://thread.gmane.org/gmane.emacs.orgmode/92820
>
> This solution looks very specific to a particular problem.

It is a solution to the problem:

   Place multiple images on one way the Correct Wayᵀᴹ when using ox-latex.

> I'm not interested in captions at all.

They can be removed.

> I just have 3 images, roughly the same width by different heights, and
> I'd like to place them side by side, with the tops aligned. I doesn't
> have to be a table, but I assume that would be the simplest way to do
> this (except I haven't made it work yet.)

The simplest way is special blocks.

Nonetheless, if you feel strongly about tables you could do it like this¹:

     #+latex_header: \def\imgtop#1{\vtop{\null\hbox{#1}}}
     #+macro: imgtop @@latex:\imgtop{@@ $1 @@latex:}@@

     #+attr_latex: :booktabs nil
     | <c>                             | <c>                             |
     | {{{imgtop([[file:img1.png]])}}} | {{{imgtop([[file:img2.png]])}}} |

Hope it helps,
Rasmus

Footnotes: 
¹   See: http://tex.stackexchange.com/questions/23521/tabular-vertical-alignment-to-top

-- 
May contains speling mistake

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

* Re: Vertically aligning images in tables?
  2016-01-15 17:13 ` Rasmus
@ 2016-01-15 17:15   ` Rasmus
  0 siblings, 0 replies; 12+ messages in thread
From: Rasmus @ 2016-01-15 17:15 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> It is a solution to the problem:
>
>    Place multiple images on one way the Correct Wayᵀᴹ when using ox-latex.
                                  ^^^
                                  line

Typo.

-- 
Look, it is what it is because of what it was

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

* Re: Vertically aligning images in tables?
@ 2016-01-15 18:18 Peter Davis
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Davis @ 2016-01-15 18:18 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 14 Jan 2016 at 17:05, Peter Davis wrote:
>> I'm trying to place three images side-by-side to they're top-aligned,
>> but I can't see to find a way to get org-mode to do this. My
>
> Following up on my previous email, I couldn't resist...
>
> A LaTeX hack that works is:
>
> #+begin_src org
>   ,* introduction
>   ,#+latex: \newcommand{\boxedimage}[1]{\parbox[b][20pt][t]{1.5cm}{\includegraphics[scale=0.3]{#1}}}
>   ,#+MACRO: p  \boxedimage{$1}
>   ,#+ATTR_LATEX: :align ccc
>   |------------------+------------------+--------------------|
>   | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
>   |------------------+------------------+--------------------|
>
> #+end_src
>
> I tried to have everything in the macro but org started escaping some of
> the curly braces unfortunately...

Thanks, Eric. This seems very close, although in one case, the text below the table is overlapping the images. I should be able to
fix that.

Thank you!

-pd

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

* Re: Vertically aligning images in tables?
@ 2016-01-15 18:24 Peter Davis
  2016-01-15 19:36 ` John Hendy
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Davis @ 2016-01-15 18:24 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode


Hi, John,

Yes, of course I Googled it first. I went through the first couple of pages of results without finding anything that appeared to be
suitable for use with org. Of course, I'm neither a LaTeX expert nor an Org expert, so it's likely that I misunderstood.

You seem to have a complaint about every question I post here, so evidently I'm abusing the list. I'm sorry for taking up too much
of your time.

Goodbye.
-pd


John Hendy <jw.hendy@gmail.com> writes:

> Have you just googled for this? Honestly, I find StackOverflow (and
> fam) much better than the mailing list for this sort of thing. Almost
> any LaTeX question you can ask has already been asked. Try googling
> "latex top align image tabular" and see if the first page of hits
> (almost all latex.SE) gets you close. Org integration is another
> thing, but at least you'll know definitively what you want to
> implement in LaTeX.
>
> John
>
> On Thu, Jan 14, 2016 at 4:05 PM, Peter Davis <pfd@pfdstudio.com> wrote:
>>
>> I'm trying to place three images side-by-side to they're top-aligned, but I can't see to find a way to get org-mode to do this. My
>> current code is:
>>
>> +----
>> | #+MACRO: p  \includegraphics[scale=.3]{$1}
>> | #+ATTR_LATEX: :align {p{5cm} p{5cm} p{5cm}}
>> | | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
>> +----
>>
>> As far as I can tell from LaTeX doc, the p attribute is supposed to top-align the contents, but it's not doing that.
>>
>> Have I missed something?
>>
>> Thanks,
>> -pd
>>

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

* Re: Vertically aligning images in tables?
@ 2016-01-15 18:26 Peter Davis
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Davis @ 2016-01-15 18:26 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode


Thank you, Rasmus.

Regards,
-pd

Rasmus <rasmus@gmx.us> writes:

> Hi Peter,
>
> Peter Davis <pfd@pfdstudio.com> writes:
>
>>>     http://thread.gmane.org/gmane.emacs.orgmode/92820
>>
>> This solution looks very specific to a particular problem.
>
> It is a solution to the problem:
>
>    Place multiple images on one way the Correct Wayᵀᴹ when using ox-latex.
>
>> I'm not interested in captions at all.
>
> They can be removed.
>
>> I just have 3 images, roughly the same width by different heights, and
>> I'd like to place them side by side, with the tops aligned. I doesn't
>> have to be a table, but I assume that would be the simplest way to do
>> this (except I haven't made it work yet.)
>
> The simplest way is special blocks.
>
> Nonetheless, if you feel strongly about tables you could do it like this¹:
>
>      #+latex_header: \def\imgtop#1{\vtop{\null\hbox{#1}}}
>
>      #+macro: imgtop @@latex:\imgtop{@@ $1 @@latex:}@@
>
>      #+attr_latex: :booktabs nil
>      | <c>                             | <c>                             |
>      | {{{imgtop([[file:img1.png]])}}} | {{{imgtop([[file:img2.png]])}}} |
>
> Hope it helps,
> Rasmus
>
> Footnotes: 
> ¹   See: http://tex.stackexchange.com/questions/23521/tabular-vertical-alignment-to-top

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

* Re: Vertically aligning images in tables?
  2016-01-15 18:24 Peter Davis
@ 2016-01-15 19:36 ` John Hendy
  0 siblings, 0 replies; 12+ messages in thread
From: John Hendy @ 2016-01-15 19:36 UTC (permalink / raw)
  To: Peter Davis; +Cc: emacs-orgmode

On Fri, Jan 15, 2016 at 12:24 PM, Peter Davis <pfd@pfdstudio.com> wrote:
>
> Hi, John,
>
> Yes, of course I Googled it first. I went through the first couple of pages of results without finding anything that appeared to be
> suitable for use with org. Of course, I'm neither a LaTeX expert nor an Org expert, so it's likely that I misunderstood.
>
> You seem to have a complaint about every question I post here, so evidently I'm abusing the list. I'm sorry for taking up too much
> of your time.

I promise I don't mean to single you out! I respond to the issues as I see them.

My thought when reading was whether or not the issue was LaTeX related
or Org related. While many readers of the list *are* LaTeX experts, in
my opinion it's a lot easier to solve it in LaTeX first (via direct
routes) and post to the list with something like:

"This works in latex:

#+begin_latex
... code ...
#+end_latex

How could I do that in Org?"

Otherwise, those not knowing any better (myself) are left looking for
an Org solution when it's really a matter of solving the LaTeX end of
things. When I went to look for LaTeX-specific fixes, I didn't see
anyone using code like yours (except with things like
\baseline{value}), so it made me wonder why you might think that would
work. Intuitively, if p works, I'd think it would show up on latex.SE.
I'm guessing previous replies have colored the most recent one. It was
just meant as a suggestion to get an answer faster, nothing against
you!


John

>
> Goodbye.
> -pd
>
>
> John Hendy <jw.hendy@gmail.com> writes:
>
>> Have you just googled for this? Honestly, I find StackOverflow (and
>> fam) much better than the mailing list for this sort of thing. Almost
>> any LaTeX question you can ask has already been asked. Try googling
>> "latex top align image tabular" and see if the first page of hits
>> (almost all latex.SE) gets you close. Org integration is another
>> thing, but at least you'll know definitively what you want to
>> implement in LaTeX.
>>
>> John
>>
>> On Thu, Jan 14, 2016 at 4:05 PM, Peter Davis <pfd@pfdstudio.com> wrote:
>>>
>>> I'm trying to place three images side-by-side to they're top-aligned, but I can't see to find a way to get org-mode to do this. My
>>> current code is:
>>>
>>> +----
>>> | #+MACRO: p  \includegraphics[scale=.3]{$1}
>>> | #+ATTR_LATEX: :align {p{5cm} p{5cm} p{5cm}}
>>> | | {{{p(./A.png)}}} | {{{p(./B.png)}}} | {{{p(./C.png)}}}   |
>>> +----
>>>
>>> As far as I can tell from LaTeX doc, the p attribute is supposed to top-align the contents, but it's not doing that.
>>>
>>> Have I missed something?
>>>
>>> Thanks,
>>> -pd
>>>

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

end of thread, other threads:[~2016-01-15 19:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-14 22:05 Vertically aligning images in tables? Peter Davis
2016-01-15 12:16 ` Rasmus
2016-01-15 16:44 ` Eric S Fraga
2016-01-15 17:03 ` Eric S Fraga
2016-01-15 17:10 ` John Hendy
  -- strict thread matches above, loose matches on Subject: below --
2016-01-15 15:16 Peter Davis
2016-01-15 17:13 ` Rasmus
2016-01-15 17:15   ` Rasmus
2016-01-15 18:18 Peter Davis
2016-01-15 18:24 Peter Davis
2016-01-15 19:36 ` John Hendy
2016-01-15 18:26 Peter Davis

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).