Code Monkey home page Code Monkey logo

Comments (13)

linktohack avatar linktohack commented on July 29, 2024

The hook/filter function only does search/replace etc at table level at the moment. I'd like to have a better approach actually.

Anyway can you post here a minimal example with actual and desired result?

from ox-latex-subfigure.

 avatar commented on July 29, 2024

** Output with actual configuration

#+begin_src emacs-lisp
(setq org-latex-tables-centered nil)
#+end_src

#+LATEX_HEADER: \makeatletter
#+LATEX_HEADER: \g@addto@macro@floatboxreset\centering
#+LATEX_HEADER: \makeatother

#+CAPTION[short caption]: NORMAL FIGURE
#+LABEL: fig:figure
[[~/thesis/figure/a.pdf]]

BECOMES:
\begin{figure}[!htbp]
\centering
\includegraphics{/home/mcg/thesis/figure/a.pdf}
\caption[short caption]{\label{fig:figure}
long caption}
\end{figure}

#+CAPTION[short caption]: SUBFIGURE
#+LABEL: fig:subfigure
#+ATTR_LATEX: :environment subfigure :width 0.49\linewidth :align b
| subcation a) | subcaption b) |
| [[/thesis/figure/a.pdf]] | [[/thesis/figure/b.pdf]] |

BECOMES (no \centering)

\begin{figure}[!htbp]
\caption[short caption]{\label{fig:subfigure}
long caption}
\begin{subfigure}[b]{0.49\linewidth}
\includegraphics{/home/mcg/thesis/figure/a.pdf}
\caption{subcation a)}
\end{subfigure}
\begin{subfigure}[b]{0.49\linewidth}
\includegraphics{/home/mcg/thesis/figure/b.pdf}
\caption{subcaption b)}
\end{subfigure}
\end{figure}

** Desired output

Only with org-latex-tables-centered enabled I get the right output - but that is not an option for me...

#+begin_src emacs-lisp
(setq org-latex-tables-centered t)
#+end_src

#+CAPTION[short caption]: long caption
#+LABEL: fig:subfigure
#+ATTR_LATEX: :environment subfigure :width 0.49\linewidth :align b
| subcation a) | subcaption b) |
| [[/thesis/figure/a.pdf]] | [[/thesis/figure/b.pdf]] |

\begin{figure}[!htbp]
\caption[short caption]{\label{fig:subfigure}
long caption}
\centering
\begin{subfigure}[b]{0.49\linewidth}
\includegraphics{/home/mcg/thesis/figure/a.pdf}
\caption{subcation a)}
\end{subfigure}
\begin{subfigure}[b]{0.49\linewidth}
\includegraphics{/home/mcg/thesis/figure/b.pdf}
\caption{subcaption b)}
\end{subfigure}
\end{figure}

As I said, for me it would be enough to use centering for all cases, no need for a condition. I know mine is a special case, as usually you would just turn on org-latex-tables-centered. But that option conflicts with threeparttable...
So any indication on how to modify the code for my use case would be welcome if you do not want to include another option. For now, I just do not understand why \g@addto@macro@floatboxreset\centering does not center it anyway.

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

I see, let's try to replace the default value here https://github.com/linktohack/ox-latex-subfigure/blob/master/ox-latex-subfigure.el#L31 from (centering "") to (centering "\\centering\n") to see if it works for you...

from ox-latex-subfigure.

 avatar commented on July 29, 2024

\centering now gets inserted. Thank you!

But I notice now that this was not even causing the problem,
My graph gets off center, because one is wider than the other, and
apparantly within the subfigure environment it gets left aligned.

Which brings me to another question: (or should I open a new issue?)

Do you think it would be possible to somehow include several :width
statements, for each subfigure, to get different sized subfigures? This
came up now, as until now all subfigures were of the same width...)
Or is that too complicated to implement?

All the best,

On 07/03/16 22:34, Quang-Linh LE wrote:

I see, let's try to replace the default value here
https://github.com/linktohack/ox-latex-subfigure/blob/master/ox-latex-subfigure.el#L31
from |(centering "")| to |(centering "\centering\n")| to see if it
works for you...


Reply to this email directly or view it on GitHub
#3 (comment).

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

It's not too complicated to include a list of width etc but then it will be a little messy. A cleaner solution maybe just include a LaTeX fragment/block?

from ox-latex-subfigure.

 avatar commented on July 29, 2024

I kind of found a solution to off-centered figures, just now:
Adding \centering in front of the file:link in the table adds \centering within the subfigure environment, which also resolves my problem for now and could (for my case again) be the default behaviour.
And you are right; for the more specific cases then I will take the LaTeX code block...

((string-match "^\begin{subfigure}({(.?)})?({(.?)})?" row)
Could I add \n \centering\n" in this line to make it default? But where? Thanks again...

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

Glad you find a solution. You can insert after this line, (and before %s)

(insert (format "\\begin{subfigure}[%s]{%s}

from ox-latex-subfigure.

 avatar commented on July 29, 2024

Everything working, nice! Thank you very much again once more...

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

Nice, you may also interested in https://github.com/linktohack/synorg, a syntex-like feature but work directly with org mode...

from ox-latex-subfigure.

 avatar commented on July 29, 2024

That looks fine; I have a look these days - does it also work with external pdf viewer (evince)? - just curious, if not the internal one is fine...

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

You need to configure the AUCTeX to use Evince as an external viewer, but it should. Working fine for me with Skim on OSX (there are some limitations though...)

from ox-latex-subfigure.

 avatar commented on July 29, 2024

OK - I think I have that configured already... I'll sure give it a try,
that's been bothering me for a long time to always have to search in
the org-mode / pdf...

On 07/03/16 23:55, Quang-Linh LE wrote:

You need to configure the AUCTeX to use Evince as an external viewer,
but it should. Working fine for me with Skim on OSX (there is some
limits though...)


Reply to this email directly or view it on GitHub
#3 (comment).

from ox-latex-subfigure.

linktohack avatar linktohack commented on July 29, 2024

OK, cool, I'm closing this

from ox-latex-subfigure.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.