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

Add options to add TeX libraries and add to the TeX preamble in the PGtikz.pl macro #541

Merged
merged 1 commit into from
Mar 10, 2021

Conversation

drgrice1
Copy link
Member

@drgrice1 drgrice1 commented Mar 3, 2021

This makes that method more versatile. For example, with this you can use the pgfplots package.

This was also something that was requested when the PGtikz.pl macro was originally introduced (see #432 (comment)).

You can test this with the attached pg file.
tikz-package-test.zip

TikzImage.pm/PGtikz.pl macro.  This makes that method more versatile.
@drgrice1 drgrice1 added this to the PG-2.16 milestone Mar 3, 2021
@taniwallach
Copy link
Member

Before patch:

Warning -- There may be something wrong with this question. Please inform your instructor including the warning messages below.

Error messages

ERRORS from evaluating PG file:
Can't locate object method "texPackages" via package "TikZImage" at line 22 of (eval 9765) 

After patch - no error from PG, but the image did not render for me.
In /var/log/apache2/error.log (of Docker) I found:

Can't exec "/usr/bin/convert": No such file or directory at /opt/webwork/pg/lib/TikZImage.pm line 157.
Convert operation failed. at /opt/webwork/pg/lib/TikZImage.pm line 168.
apache2Can't print graph to /opt/webwork/webwork2/htdocs/tmp/Madar_devel/images/c59732e3-9ca4-3993-ac63-3f05bc82fb29___c615607d-28ab-306a-97bb-ee032fb14d02.png<BR> at /opt/webwork/pg/lib/PGcore.pm line 719.

so I installed: apt-get update; apt-get install imagemagick in the running Docker container.

Still not working... but then I saw #432 (comment) and
edited /etc/ImageMagick-6/policy.xml and to change the line

  <policy domain="coder" rights="none" pattern="PDF" />

to

  <policy domain="coder" rights="read" pattern="PDF" />

and deleted the empty temporary file. Then a problem reload generated the image.


We need to make instructions about editing /etc/ImageMagick-6/policy.xml and the potential security implications make it into the release notes and the installation instructions.

Copy link
Member

@taniwallach taniwallach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional features make sense and seem very useful.
Testing with the sample file was successful, once the prerequisite packages were installed and configuration settings made.

@drgrice1
Copy link
Member Author

drgrice1 commented Mar 8, 2021

The attached problem will not work without this pull request.

The issue that you are seeing with imagemagick's convert program is documented in site.conf.dist. Although we will need to add that to release documentation as well as you say. This is true for the PGtikz.pl macro without this pull request. This was added by #432 and openwebwork/webwork2#1030.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I too needed to configure all the external programs in site.conf, but afterward, worked great.

I'll definitely use this as I am a big tikz user.

taniwallach added a commit to taniwallach/webwork2 that referenced this pull request Mar 10, 2021
Additional Ubuntu packages:
	libcgi-pm-perl (for CGI::Cookie)
	libdbd-mariadb-perl (for alternate DB connector)
	iputils-ping (prevents ping during startup from failing)
	imagemagick (needed by openwebwork/pg#541)

docker-compose.yml:

  * Set fixed container names (so names will not depend on name of directory where docker-compose is being run.

  * Sample lines to use some new sample DB config files + brief comments.

  * Sample line to make host /etc/localtime read-only available to the DB container.

  * Sample ulimits + timezone lines for the DB container.

  * Set the Docker container to mount the updated Lite.pm with the UTF-8 patch.

  * Sample lines to use either DB connector. Default remains the "old" DBD::mysql driver.

  * Modify the bottom "main" volumes section, so fixed persistant volumes are used for the OPL and the DB storage, regardless of the directory name where docker-compose is run.
@taniwallach taniwallach merged commit c7692ec into openwebwork:develop Mar 10, 2021
@drgrice1 drgrice1 deleted the pgtikz-improvements branch March 10, 2021 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants