Re: lyx-archive question

2017-01-19 Thread Scott Kostyshak
On Thu, Jan 19, 2017 at 07:11:31PM +0100, Wolfgang Engelmann wrote:

> > > > If your .lyx file is in /A/B/ and you include a figure in /A/B/ then
> > > > when you insert a graphics file is the path that is shown in the text
> > > > box relative or absolute?
> > > > 
> > > > Scott
> > > The path is absolute
> > I see. So this is the source of the problem. I don't know why we see
> > something different. Just out of curiosity (of course this is not a
> > fix), what happens if you first set the "Working directory" path in
> > Tools > Paths to /A/B, restart LyX, and then include the figure. Now
> > relative path or still absolute?
> > 
> > Scott
> Yes, that is a way. However, LyX remembers this path for the next project I
> am working on and I have to change the path again for this lyx-file. But
> that is alright.
> Thanks Scott
> Wolfgang

I can't reproduce the behavior you see. My working directory for LyX
2.2.1 is set to /home/scott. But when if I open LyX, and open a .lyx
file in /A/B/ and then include a file that is also in /A/B/ I get a
relative link. I wonder why we see different behaviors.

Scott


signature.asc
Description: PGP signature


Re: lyx-archive question

2017-01-19 Thread Wolfgang Engelmann



On 19.01.2017 18:30, Scott Kostyshak wrote:

On Thu, Jan 19, 2017 at 05:06:28PM +0100, Wolfgang Engelmann wrote:


On 19.01.2017 16:48, Scott Kostyshak wrote:

On Thu, Jan 19, 2017 at 03:13:45PM +0100, Wolfgang Engelmann wrote:

Lets say, I have in my home folder a folder A, which contains folder B with
my lyx file LL.lyx and all the figures, .bib-file and .bst file.

If I export it as LL.tar.gz the figures will be saved as /A/B/fig1,
/A/B/fig2 etc. If I would like to send it to my colleague, he has to create
the same folders /A/B/ and unpack the .gz file there. It would be nicer to
send it to him in such a way that it does not matter where he unpacks it,
i.e. send the content as fig1, fig2 etc.

I can do it by opening the lyx file with a text editor and replace all
"/A/B/fig's" by "fig's", but it would be nicer to do this inside lyx. I
could think of the following: I include the fig's and lyx is prevented from
saving them as /A/B/fig's but to use fig's. Or lyx offers a way to get rid
of the folders in front of the fig's.

The same issue turns up if I shift the content of my working folder to
another one.

How would you proceed

If your .lyx file is in /A/B/ and you include a figure in /A/B/ then
when you insert a graphics file is the path that is shown in the text
box relative or absolute?

Scott

The path is absolute

I see. So this is the source of the problem. I don't know why we see
something different. Just out of curiosity (of course this is not a
fix), what happens if you first set the "Working directory" path in
Tools > Paths to /A/B, restart LyX, and then include the figure. Now
relative path or still absolute?

Scott
Yes, that is a way. However, LyX remembers this path for the next 
project I am working on and I have to change the path again for this 
lyx-file. But that is alright.

Thanks Scott
Wolfgang


Re: lyx-archive question

2017-01-19 Thread Scott Kostyshak
On Thu, Jan 19, 2017 at 05:06:28PM +0100, Wolfgang Engelmann wrote:
> 
> 
> On 19.01.2017 16:48, Scott Kostyshak wrote:
> > On Thu, Jan 19, 2017 at 03:13:45PM +0100, Wolfgang Engelmann wrote:
> > > Lets say, I have in my home folder a folder A, which contains folder B 
> > > with
> > > my lyx file LL.lyx and all the figures, .bib-file and .bst file.
> > > 
> > > If I export it as LL.tar.gz the figures will be saved as /A/B/fig1,
> > > /A/B/fig2 etc. If I would like to send it to my colleague, he has to 
> > > create
> > > the same folders /A/B/ and unpack the .gz file there. It would be nicer to
> > > send it to him in such a way that it does not matter where he unpacks it,
> > > i.e. send the content as fig1, fig2 etc.
> > > 
> > > I can do it by opening the lyx file with a text editor and replace all
> > > "/A/B/fig's" by "fig's", but it would be nicer to do this inside lyx. I
> > > could think of the following: I include the fig's and lyx is prevented 
> > > from
> > > saving them as /A/B/fig's but to use fig's. Or lyx offers a way to get rid
> > > of the folders in front of the fig's.
> > > 
> > > The same issue turns up if I shift the content of my working folder to
> > > another one.
> > > 
> > > How would you proceed
> > If your .lyx file is in /A/B/ and you include a figure in /A/B/ then
> > when you insert a graphics file is the path that is shown in the text
> > box relative or absolute?
> > 
> > Scott
> The path is absolute

I see. So this is the source of the problem. I don't know why we see
something different. Just out of curiosity (of course this is not a
fix), what happens if you first set the "Working directory" path in
Tools > Paths to /A/B, restart LyX, and then include the figure. Now
relative path or still absolute?

Scott


signature.asc
Description: PGP signature


Re: lyx-archive question

2017-01-19 Thread Wolfgang Engelmann



On 19.01.2017 16:48, Scott Kostyshak wrote:

On Thu, Jan 19, 2017 at 03:13:45PM +0100, Wolfgang Engelmann wrote:

Lets say, I have in my home folder a folder A, which contains folder B with
my lyx file LL.lyx and all the figures, .bib-file and .bst file.

If I export it as LL.tar.gz the figures will be saved as /A/B/fig1,
/A/B/fig2 etc. If I would like to send it to my colleague, he has to create
the same folders /A/B/ and unpack the .gz file there. It would be nicer to
send it to him in such a way that it does not matter where he unpacks it,
i.e. send the content as fig1, fig2 etc.

I can do it by opening the lyx file with a text editor and replace all
"/A/B/fig's" by "fig's", but it would be nicer to do this inside lyx. I
could think of the following: I include the fig's and lyx is prevented from
saving them as /A/B/fig's but to use fig's. Or lyx offers a way to get rid
of the folders in front of the fig's.

The same issue turns up if I shift the content of my working folder to
another one.

How would you proceed

If your .lyx file is in /A/B/ and you include a figure in /A/B/ then
when you insert a graphics file is the path that is shown in the text
box relative or absolute?

Scott

The path is absolute
Wolfgang


Re: lyx-archive question

2017-01-19 Thread Scott Kostyshak
On Thu, Jan 19, 2017 at 03:13:45PM +0100, Wolfgang Engelmann wrote:
> Lets say, I have in my home folder a folder A, which contains folder B with
> my lyx file LL.lyx and all the figures, .bib-file and .bst file.
> 
> If I export it as LL.tar.gz the figures will be saved as /A/B/fig1,
> /A/B/fig2 etc. If I would like to send it to my colleague, he has to create
> the same folders /A/B/ and unpack the .gz file there. It would be nicer to
> send it to him in such a way that it does not matter where he unpacks it,
> i.e. send the content as fig1, fig2 etc.
> 
> I can do it by opening the lyx file with a text editor and replace all
> "/A/B/fig's" by "fig's", but it would be nicer to do this inside lyx. I
> could think of the following: I include the fig's and lyx is prevented from
> saving them as /A/B/fig's but to use fig's. Or lyx offers a way to get rid
> of the folders in front of the fig's.
> 
> The same issue turns up if I shift the content of my working folder to
> another one.
> 
> How would you proceed

If your .lyx file is in /A/B/ and you include a figure in /A/B/ then
when you insert a graphics file is the path that is shown in the text
box relative or absolute?

Scott


signature.asc
Description: PGP signature


Re: lyx archive

2015-04-13 Thread Rainer M Krug
Wolfgang Engelmann  writes:

> Thanks, Enrico,
>
> however, I was not asking for that, but for a quick and perhaps
> general (i.e. for the whole document) way to remove a path. Example:
> pathX/picture1
> should be turned into
> picture1
> same with
> pathX/picture2
> should be turned into
> picture2
> same with
> pathy/picture3
> should be turned into
> picture3
> etc

Just open the .lyx file (after you made a backup of course) in any text
editor and do a search - replace. That's what I did for a paper.

Not very lyxisch, but it works.

Cheers,

Rainer

>
> Note that I did copy all the outside pictures in question in the
> folder with my lyx document.
> Wolfgang
>
> Am 12.04.2015 um 18:41 schrieb Enrico Forestieri:
>> Wolfgang Engelmann writes:
>>> Is there a better way of getting all figures/tables in the same folder
>>> so that the tar.gz has no subtrees?
>>> I often get figures from other folders/subfolders (e.g. by a colleague)
>>> which especially with larger documents I notice not before I have
>>> archived (>file>export>lyx archive) the document.
>>> If so, I copy these files in the main folder. However, lyx remembers the
>>> former path(es) and does not find the copied one. What I do is to open
>>> the lyx file with an editor and remove the (now wrong) paths, which is
>>> easier than going through the individual items changing paths in lyx.
>>> I just wonder, whether there is a lyx way of doing it (so to speak,
>>> resetting the paths to a default - the figure only).
>> No, there is currently no way to do that within LyX. Note that this is
>> not a problem with a lyx archive only. If you have figures outside the
>> document dir and you try to export to latex, if a figure needs to be
>> converted to a format the particular latex flavor can handle, the
>> converted figure is placed alongside the original one. So, for example,
>> if you reference a figure in a directory where you don't have write
>> permission, the export fails. All of this could be handled by adding a
>> submenu entry (maybe in the "Document" menu) "Copy files to document dir"
>> (or something along that line). This would cause LyX to scan all used
>> files and copy those outside the document dir to a common subdir named
>> -files, updating also the internal paths. In this way, both
>> export and archive will produce a self-contained subtree.
>> Please, feel free to file an enhancement request at
>> http://www.lyx.org/trac/wiki/BugTrackerHome.
>>
>
>

-- 
Rainer M. Krug
email: Rainerkrugsde
PGP: 0x0F52F982


signature.asc
Description: PGP signature


Re: lyx archive

2015-04-12 Thread Wolfgang Engelmann

Thanks, Enrico,

however, I was not asking for that, but for a quick and perhaps general 
(i.e. for the whole document) way to remove a path. Example:

pathX/picture1
should be turned into
picture1
same with
pathX/picture2
should be turned into
picture2
same with
pathy/picture3
should be turned into
picture3
etc

Note that I did copy all the outside pictures in question in the folder 
with my lyx document.

Wolfgang

Am 12.04.2015 um 18:41 schrieb Enrico Forestieri:

Wolfgang Engelmann writes:

Is there a better way of getting all figures/tables in the same folder
so that the tar.gz has no subtrees?
I often get figures from other folders/subfolders (e.g. by a colleague)
which especially with larger documents I notice not before I have
archived (>file>export>lyx archive) the document.
If so, I copy these files in the main folder. However, lyx remembers the
former path(es) and does not find the copied one. What I do is to open
the lyx file with an editor and remove the (now wrong) paths, which is
easier than going through the individual items changing paths in lyx.
I just wonder, whether there is a lyx way of doing it (so to speak,
resetting the paths to a default - the figure only).

No, there is currently no way to do that within LyX. Note that this is
not a problem with a lyx archive only. If you have figures outside the
document dir and you try to export to latex, if a figure needs to be
converted to a format the particular latex flavor can handle, the
converted figure is placed alongside the original one. So, for example,
if you reference a figure in a directory where you don't have write
permission, the export fails. All of this could be handled by adding a
submenu entry (maybe in the "Document" menu) "Copy files to document dir"
(or something along that line). This would cause LyX to scan all used
files and copy those outside the document dir to a common subdir named
-files, updating also the internal paths. In this way, both
export and archive will produce a self-contained subtree.
Please, feel free to file an enhancement request at
http://www.lyx.org/trac/wiki/BugTrackerHome.





Re: lyx archive

2015-04-12 Thread Enrico Forestieri
Wolfgang Engelmann writes:
> 
> Is there a better way of getting all figures/tables in the same folder 
> so that the tar.gz has no subtrees?
> I often get figures from other folders/subfolders (e.g. by a colleague) 
> which especially with larger documents I notice not before I have 
> archived (>file>export>lyx archive) the document.
> If so, I copy these files in the main folder. However, lyx remembers the 
> former path(es) and does not find the copied one. What I do is to open 
> the lyx file with an editor and remove the (now wrong) paths, which is 
> easier than going through the individual items changing paths in lyx.
> I just wonder, whether there is a lyx way of doing it (so to speak, 
> resetting the paths to a default - the figure only).

No, there is currently no way to do that within LyX. Note that this is
not a problem with a lyx archive only. If you have figures outside the
document dir and you try to export to latex, if a figure needs to be
converted to a format the particular latex flavor can handle, the
converted figure is placed alongside the original one. So, for example,
if you reference a figure in a directory where you don't have write
permission, the export fails. All of this could be handled by adding a
submenu entry (maybe in the "Document" menu) "Copy files to document dir"
(or something along that line). This would cause LyX to scan all used
files and copy those outside the document dir to a common subdir named
-files, updating also the internal paths. In this way, both
export and archive will produce a self-contained subtree.
Please, feel free to file an enhancement request at
http://www.lyx.org/trac/wiki/BugTrackerHome.



Re: lyx archive error

2012-02-20 Thread Enrico Forestieri
On Fri, Feb 17, 2012 at 04:49:58PM +0100, Pavel Sanda wrote:

> Waluyo Adi Siswanto wrote:
> > I have found the cause. It could be a bug?
> > ANY file using SPACE in its filename will fail to export archive.
> > I tried in Ubuntu 11.10 and Windows 7, both fail.
> 
> Yes, the problem is due to spacing in path. Enrico may know whether
> is it easy to fix..

The lyxpak.py script has no problem with spaces in filenames. It is LyX
that is passing a mangled filename. Specifically, LyX calls lyxpak.py
using the mangled name meant for latex processing in the temporary dir.

The attached patch fixes the problem for me.

-- 
Enrico
Index: src/Converter.cpp
===
--- src/Converter.cpp   (revisione 40771)
+++ src/Converter.cpp   (copia locale)
@@ -50,6 +50,7 @@ string const token_base("$$b");
 string const token_to("$$o");
 string const token_path("$$p");
 string const token_orig_path("$$r");
+string const token_orig_from("$$f");
 string const token_encoding("$$e");
 string const token_latex_encoding("$$E");
 
@@ -412,6 +413,7 @@ bool Converters::convert(Buffer const *
command = subst(command, token_to, quoteName(outfile2));
command = subst(command, token_path, 
quoteName(onlyPath(infile.absFileName(;
command = subst(command, token_orig_path, 
quoteName(onlyPath(orig_from.absFileName(;
+   command = subst(command, token_orig_from, 
quoteName(onlyFileName(orig_from.absFileName(;
command = subst(command, token_encoding, buffer ? 
buffer->params().encoding().iconvName() : string());
command = libScriptSearch(command);
 
Index: lib/configure.py
===
--- lib/configure.py(revisione 40771)
+++ lib/configure.py(copia locale)
@@ -920,7 +920,7 @@ def checkConverterEntries():
 # Currently, lyxpak outputs a gzip compressed tar archive on *nix
 # and a zip archive on Windows.
 # So, we configure the appropriate version according to the platform.
-cmd = r'\converter lyx %s "python -tt $$s/scripts/lyxpak.py $$r/$$i" ""'
+cmd = r'\converter lyx %s "python -tt $$s/scripts/lyxpak.py $$r/$$f" ""'
 if os.name == 'nt':
 addToRC(r'\Format lyxzip zip"LyX Archive (zip)" "" "" ""  
"document,menu=export"')
 addToRC(cmd % "lyxzip")


Re: lyx archive error

2012-02-17 Thread Richard Heck

On 02/17/2012 05:56 PM, Enrico Forestieri wrote:

On Fri, Feb 17, 2012 at 04:49:58PM +0100, Pavel Sanda wrote:


Waluyo Adi Siswanto wrote:

I have found the cause. It could be a bug?
ANY file using SPACE in its filename will fail to export archive.
I tried in Ubuntu 11.10 and Windows 7, both fail.

Yes, the problem is due to spacing in path. Enrico may know whether
is it easy to fix..

The lyxpak.py script has no problem with spaces in filenames. It is LyX
that is passing a mangled filename. Specifically, LyX calls lyxpak.py
using the mangled name meant for latex processing in the temporary dir.

The attached patch fixes the problem for me.


Good enough for me.

Richard




Re: lyx archive error

2012-02-17 Thread Pavel Sanda
Waluyo Adi Siswanto wrote:
> I have found the cause. It could be a bug?
> ANY file using SPACE in its filename will fail to export archive.
> I tried in Ubuntu 11.10 and Windows 7, both fail.

Yes, the problem is due to spacing in path. Enrico may know whether
is it easy to fix..
Pavel


Re: lyx archive error

2012-02-16 Thread Waluyo Adi Siswanto
>>> I want to export to archive (zip) from export menu.
>>> An error popped up. What is that, how can export it in archive file?
>>> This is in windows 7, LyX 2.0.2
>>
>> Please run lyx from a terminal and you should get more output.
>>
>
> Running LyX from window terminal does not give any information,
> however I can find from the message window in lyx (attached), LyX
> cannot find the file.
> (the file name is complicated)
>
> Then I saved as newfile1.lyx, then export to archive. Now successful.
> Is this because the file name is too long or complicated ?
>
> I tried to change the file name (the last number with 12) other the
> same, also not successful.
>

I have found the cause. It could be a bug?
ANY file using SPACE in its filename will fail to export archive.
I tried in Ubuntu 11.10 and Windows 7, both fail.

lyxpac search _ instead of SPACE, therefore it fails.

regards
waluyo


Re: lyx archive error

2012-02-16 Thread Waluyo Adi Siswanto
>> I want to export to archive (zip) from export menu.
>> An error popped up. What is that, how can export it in archive file?
>> This is in windows 7, LyX 2.0.2
>
> Please run lyx from a terminal and you should get more output.
>

Running LyX from window terminal does not give any information,
however I can find from the message window in lyx (attached), LyX
cannot find the file.
(the file name is complicated)

Then I saved as newfile1.lyx, then export to archive. Now successful.
Is this because the file name is too long or complicated ?

I tried to change the file name (the last number with 12) other the
same, also not successful.


Regards
waluyo

> Richard
>
<>