Re: How to size of pdf cropped output

2020-03-21 Thread Paul A. Rubin

On 3/17/20 6:45 PM, Fred Schenkelberg wrote:

Hi - is there a way or best practice to control the size of exported (pdf 
cropped) equations such that they become a specific or at least consistent font 
height from one pdf to another?

I’m trying to use LyX as an equation editor and embedding the PDFs into 
InDesign and other documents like PowerPoint or Adobe Captivate.

cheers, Fred
I'm not sure this is the best approach, but I would use the LaTeX 
standalone class. It's a bit finicky when it comes to math, and I find 
myself having to set the page width manually (despite it being set to 
automatically crop), but it does seem to work.


Attached are two LyX files, each with one set of equations, and the 
corresponding PDFs. To my eye, the font height looks identical. You'll 
also have to make sure that the program into which they are imported 
does not scale them (or scales them equally).


Paul



newfile1.lyx
Description: application/lyx


newfile1.pdf
Description: Adobe PDF document


newfile2.lyx
Description: application/lyx


newfile2.pdf
Description: Adobe PDF document
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: Graphics problems with LyX 2.3.4.2 on Linux Mint

2020-03-21 Thread Paul A. Rubin

On 3/21/20 12:26 PM, Graeme wrote:

On 3/18/20 3:19 PM, Graeme wrote:

 I currently use Linux Mint 18.3. Recently I upgraded to LyX 2.3.4.2 
using the PPA available at


 http://ppa.launchpad.net/lyx-devel/release/ubuntu xenial main

 Since this upgrade there have been problems with the display of EPS 
and PDF graphics files in the main LyX editor window, and with the 
export of files containing PNG and JPEG bitmap images.


 These problems are not evident with LyX 2.3.4.3 on Windows 10, nor 
were they present with LyX 2.3.3 on Linux Mint 18.3.


 Specifically:

 1. When including a graphic with either EPS or PDF format, the 
graphic is not displayed in the main LyX editor window, but instead 
there is an outline box with the EPS or PDF filename, and below it 
the error message: Error converting to loadable format.


 The graphic does appear correctly in a PDF file exported using 
either ps2pdf or pdflatex.



 2. When including a graphic with PNG or JPEG format, the graphic is 
displayed correctly in the main LyX editor window, but when 
attempting to export the LyX file to Postscript, PDF (using ps2pdf), 
or even just plain LaTeX, an error pop-up window appears with the 
title:


 LyX: Cannot convert file
 and the message:  No information for converting png format files to 
eps. Define a converter in the preferences or No information for 
converting jpg format files to eps. Define a converter in the 
preferences.


 The PNG and JPEG graphics do appear correctly in a PDF file 
exported using pdflatex, but attempting to export with ps2pdf fails.



 When exporting the Progress Log window shows the following messages 
for a graphic in PNG format:


    python -tt "/usr/share/lyx/scripts/convertDefault.py" png 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.png" 
eps 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps" 
convert: not authorized 
`eps:/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps' 
@ error/constitute.c/WriteImage/1028.

    /usr/share/lyx/scripts/convertDefault.py ERROR
    Execution of "convert" failed.support/Systemcall.cpp (276): 
Systemcall: 'python -tt "/usr/share/lyx/scripts/convertDefault.py" 
png 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.png" 
eps 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps"' 
finished with exit code 1

    Error: Cannot convert file

 I get similar messages for a graphic file in JPEG format.

 My suspicion is that BOTH the problems above may be linked to the 
use of ImageMagick within convertDefault.py, but I am puzzled by the 
warning message

 "convert: not authorized"
 in the fragment above, suggesting it may be something to do with 
file or folder permissions. However, this does not explain why 
everything seemed to work OK with LyX 2.3.3 on Mint 18.3


 On Mint 18.3 the system-wide installation of ImageMagick is:
 ImageMagick 6.8.9-9 Q16 x86_64 2019-11-12

 On Windows 10, the LyX2.3.4.3 installer comes bundled with a later 
version:

 ImageMagick 7.0.9-19 Q16 x86 2020-01-26
 which explicitly lists built-in support for gslib and ps, but 
ImageMagick 6 does not list these among its "Delegates".



 I would welcome advice on how to fix these problems.

 Graeme



Confirmed here (same OS and LyX version). Turns out it's a security 
issue related to ImageMagick. See this post 
 for 
the gory details. If you're willing to take the risk (I am), you can 
follow the suggestions in the post, but there may be a quicker way. 
Wander over to /etc/Imagick-6 and list the directory. You should see 
policy.xml and policy.xml.dpkg-old. They former is the higher 
security/problematic policy file in force, and the .dpkg-old version 
is the looser, less secure (but more LyX friendly) version. As root, 
give the new one a new name or extension to keep it (or delete it if 
you will) and move or copy the .dpkg-old version to policy.xml. 
Worked for me.


Paul



Thanks, Paul, for your quick and helpful reply.
Unfortunately, in my Mint etc/ImageMagick-6 folder there was only 
policy.xml with no .dpkg-old version with which to compare or replace it.


I followed the link you supplied, had a look at the documentation for 
ImageMagick, and at the policy.xml file bundled with LyX for Windows, 
but the syntax and terminology of policy.xml files remains rather 
obscure to me.


Since it's the effect of these security policies on the behaviour of 
ImageMagick with EPS (and PS) files that matters. I've made small 
changes to the ImageMagick-6 version that allow the convert command to 
operate as desired on EPS and PDF files.


The key code fragment in /etc/ImageMagick-6/policy.xml is in the 
 section of the file:










I modified two lines in this fragment as follows:




1. Changing only the PS line allowed the LyX editor 

Re: Graphics problems with LyX 2.3.4.2 on Linux Mint

2020-03-21 Thread Graeme

On 3/18/20 3:19 PM, Graeme wrote:

 I currently use Linux Mint 18.3. Recently I upgraded to LyX 2.3.4.2 using the 
PPA available at

 http://ppa.launchpad.net/lyx-devel/release/ubuntu xenial main

 Since this upgrade there have been problems with the display of EPS and PDF 
graphics files in the main LyX editor window, and with the export of files 
containing PNG and JPEG bitmap images.

 These problems are not evident with LyX 2.3.4.3 on Windows 10, nor were they 
present with LyX 2.3.3 on Linux Mint 18.3.

 Specifically:

 1. When including a graphic with either EPS or PDF format, the graphic is not 
displayed in the main LyX editor window, but instead there is an outline box 
with the EPS or PDF filename, and below it the error message: Error converting 
to loadable format.

 The graphic does appear correctly in a PDF file exported using either ps2pdf 
or pdflatex.


 2. When including a graphic with PNG or JPEG format, the graphic is displayed 
correctly in the main LyX editor window, but when attempting to export the LyX 
file to Postscript, PDF (using ps2pdf), or even just plain LaTeX, an error 
pop-up window appears with the title:

 LyX: Cannot convert file
 and the message: 
 No information for converting png format files to eps. Define a converter in the preferences or No information for converting jpg format files to eps. Define a converter in the preferences.


 The PNG and JPEG graphics do appear correctly in a PDF file exported using 
pdflatex, but attempting to export with ps2pdf fails.


 When exporting the Progress Log window shows the following messages for a 
graphic in PNG format:

python -tt "/usr/share/lyx/scripts/convertDefault.py" png 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.png" eps 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps" convert: 
not authorized `eps:/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps' 
@ error/constitute.c/WriteImage/1028.
/usr/share/lyx/scripts/convertDefault.py ERROR
Execution of "convert" failed.support/Systemcall.cpp (276): Systemcall: 'python -tt 
"/usr/share/lyx/scripts/convertDefault.py" png 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.png" eps 
"/tmp/lyx_tmpdir.fGfmcihv6288/lyx_tmpbuf0/2_home_graeme_Documents_GraphicsTestCircle.eps"' finished with exit 
code 1
Error: Cannot convert file

 I get similar messages for a graphic file in JPEG format.

 My suspicion is that BOTH the problems above may be linked to the use of 
ImageMagick within convertDefault.py, but I am puzzled by the warning message
 "convert: not authorized"
 in the fragment above, suggesting it may be something to do with file or 
folder permissions. However, this does not explain why everything seemed to 
work OK with LyX 2.3.3 on Mint 18.3

 On Mint 18.3 the system-wide installation of ImageMagick is:
 ImageMagick 6.8.9-9 Q16 x86_64 2019-11-12

 On Windows 10, the LyX2.3.4.3 installer comes bundled with a later version:
 ImageMagick 7.0.9-19 Q16 x86 2020-01-26
 which explicitly lists built-in support for gslib and ps, but ImageMagick 6 does not 
list these among its "Delegates".


 I would welcome advice on how to fix these problems.

 Graeme




Confirmed here (same OS and LyX version). Turns out it's a security issue related to 
ImageMagick. See this post 
 for the gory 
details. If you're willing to take the risk (I am), you can follow the suggestions in 
the post, but there may be a quicker way. Wander over to /etc/Imagick-6 and list the 
directory. You should see policy.xml and policy.xml.dpkg-old. They former is the 
higher security/problematic policy file in force, and the .dpkg-old version is the 
looser, less secure (but more LyX friendly) version. As root, give the new one a new 
name or extension to keep it (or delete it if you will) and move or copy the 
.dpkg-old version to policy.xml. Worked for me.

Paul



Thanks, Paul, for your quick and helpful reply.
Unfortunately, in my Mint etc/ImageMagick-6 folder there was only 
policy.xml with no .dpkg-old version with which to compare or replace it.


I followed the link you supplied, had a look at the documentation for 
ImageMagick, and at the policy.xml file bundled with LyX for Windows, 
but the syntax and terminology of policy.xml files remains rather 
obscure to me.


Since it's the effect of these security policies on the behaviour of 
ImageMagick with EPS (and PS) files that matters. I've made small 
changes to the ImageMagick-6 version that allow the convert command to 
operate as desired on EPS and PDF files.


The key code fragment in /etc/ImageMagick-6/policy.xml is in the 
 section of the file:










I modified two lines in this fragment as follows:




1. Changing only the PS line allowed the LyX editor window correctly to 
display included graphic files in EPS or