Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depythontex nested \py enviroment #52

Open
Cadair opened this issue Jan 8, 2015 · 4 comments
Open

depythontex nested \py enviroment #52

Cadair opened this issue Jan 8, 2015 · 4 comments

Comments

@Cadair
Copy link

Cadair commented Jan 8, 2015

In my document I have the following LaTeX code:

    \begin{subfigure}[b]{\fwidth}
        \py[fluxTD]|get_pgf_include(fnames[3])|
        \caption{\py[fluxTD]|captions[3]|}
        \label{fig:TD_flux_r30_4}
    \end{subfigure}

which works fine under pythontex but when I run depythontex I get the following error:

* DePythonTeX error:
    Could not find command "py" on line 512

Do you have any suggestions on how I could fix this in depythontex?

@Cadair
Copy link
Author

Cadair commented Jan 8, 2015

The solution to this is to make the \py environment print out the \caption environment.

I assume this limitation of depythontex extends beyond my limited use case however,

@gpoore
Copy link
Owner

gpoore commented Jan 8, 2015

depythontex works fine with normal environments, but the subfigure environment provided by the subcaption package is using a minipage environment internally, and I believe this throws off the line numbering. depythontex currently relies on line numbers to locate the commands it is replacing, since this reduces the potential for false positives. I will need to look into a more advanced system for dealing with these sorts of cases.

I will put a note about this limitation in the next release. In more complex cases with depythontex, it is simpler to generate larger chunks of text on the Python side, rather than using a lot of interspersed \py commands.

I believe this is the first issue specifically related to depythontex. If you don't mind me asking, what sort of situation are you using it for? I haven't put much development time into depythontex since getting the first version working, because it's worked for my limited use cases. But if it is starting to get more use, I might consider improving it sooner rather than later.

@Cadair
Copy link
Author

Cadair commented Feb 5, 2015

Sorry for the slow response.

I am, in this case using PythonTeX for writing a paper manuscript here. I needed dePythonTeX to make a source file I could send to the journal.

@gpoore
Copy link
Owner

gpoore commented Feb 5, 2015

Thanks for the link! Seeing how others are using depythontex gives me a better sense of how it may be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants