On Dec 20, 2013, at 12:18 AM, Stephan Witt <st.w...@gmx.net> wrote:

> Am 20.12.2013 um 05:02 schrieb Jerry <lancebo...@qwest.net>:
> 
>> 
>> On Dec 19, 2013, at 12:53 AM, Stephan Witt <st.w...@gmx.net> wrote:
>> 
>>> Am 19.12.2013 um 01:25 schrieb Jerry <lancebo...@qwest.net>:
>>> 
>>>> 
>>>>> 
>>>>> I'm using Ubuntu and don't know anything about the modern Macs so I don't 
>>>>> understand the problem with locating the templates.  I just went to File  
>>>>> > Open from templates > and found the appropriate template.
>>>> 
>>>> On OS X, the equivalent is apparently File -> New from Template... . When 
>>>> this is done, one is taken by file browser to 
>>>> /Users/someuser/Library/Application Support/LyX-2.1/templates/ where the 
>>>> only file is defaults.lyx.
>>>> 
>>>> On OS X, an application package (aka bundle) is a special directory with a 
>>>> specified structure of subdirectories. See
>>>> https://developer.apple.com/library/mac/documentation/porting/conceptual/portingunix/distributing/distibuting.html
>>>> For example, from the directory's root, the executable is always in the 
>>>> same (relative) location. To the user, the special directory looks like an 
>>>> application (icon) and when s/he double clicks on it, instead of opening 
>>>> the folder to reveal its contents, the OS instead launches the application 
>>>> inside it. This approach allows for easy distribution of most software; 
>>>> LyX is installed by dragging a single icon from the distribution image 
>>>> anywhere onto a disk.
>>>> 
>>>> Any other code or resources may be stored in this directory structure, and 
>>>> LyX stores examples and templates in this structure. So doing File -> New 
>>>> From Template ... should open the file browser to the appropriate 
>>>> directory in this application package, not to the Application Support 
>>>> folder for LyX.
>>> 
>>> This is an old and not so easy to solve problem. There are tickets for it 
>>> in the trac system, e.g. here: 
>>> http://www.lyx.org/trac/ticket/7896
>>> 
>>> We have two places to look for templates: user templates and system 
>>> templates.
>>> IMHO, the Linux "Open file dialog" has an additional button to navigate to 
>>> the 
>>> system templates location. This button is not provided with the native OSX
>>> open file dialog and the home-brewed LyX open file dialog is not usable on 
>>> OSX.
>>> 
>>> The location of the system templates isn't well known either. You may have 
>>> more 
>>> than one LyX on your system. It has to be passed to the open file dialog at 
>>> runtime.
>>> These LyX packages may have different versions and therefor different 
>>> templates.
>>> 
>>> The best solution would be a dynamically created entry in the left side bar 
>>> of the
>>> native open file dialog. But I didn't find any API for it documented nor 
>>> any working
>>> example. It looks like the Finder only is able to create such entries.
>>> 
>>> The next idea is to add an button to the standard open file dialog, but I 
>>> don't have
>>> the skills to do this until now.
>>> 
>>> Stephan
>> 
>> That shouldn't be necessary.
>> 
>> First, the more-or-less random location of the LyX application bundle icon 
>> (the special directory that I double-click on to launch LyX) is
>> /Applications/Words/LyXOuterFolder/LyX 2.1.0 beta 2/
>> 
>> Now, in Preferences -> Paths, the following appears. I did not edit these.
>> Document Templates:
>> /Users/jb/Library/Application Support/LyX-2.1/templates
>> Example Files:
>> /Applications/Words/LyXOuterFolder/LyX 2.1.0 beta 
>> 2/LyX.app/Contents/Resources/examples/
>> 
>> I did not edit either of these. Yet, the Example Files path correctly points 
>> inside the LyX bundle whose root is LyX.app. And the Document Templates path 
>> incorrectly points to another location where the only template file is 
>> default.lyx (which was apparently installed there by the LyX program itself).
>> 
>> Now, I'll quit LyX, move the LyX icon into a dummy folder that I'll call 
>> Dummy_Folder which is just one level deeper from where it was, so that the 
>> path to the LyX icon is now 
>> /Applications/Words/LyXOuterFolder/LyX 2.1.0 beta 2/Dummy_Folder/
>> and restart LyX, then look again at the paths.
>> 
>> Document Templates:
>> /Users/jb/Library/Application Support/LyX-2.1/templates
>> Example Files:
>> /Applications/Words/LyXOuterFolder/LyX 2.1.0 beta 
>> 2/Dummy_Folder/LyX.app/Contents/Resources/examples/
>> 
>> So somehow the program is discovering where it is on my disk and 
>> automatically inserting the correct path for the examples, but the templates 
>> path is hardwired (to the wrong place), and not getting updated.
>> 
>> So all that is necessary to fix this problem is to find the code that 
>> updates the examples path and apply it to the templates path.
> 
> IMHO, you missed the point that LyX has two locations for templates but only 
> one for examples.

Well, I kind of did miss that point. But it remains that the current situation 
gives the user nothing when doing Files -> New from Template... .

So how about having two File menu items, New from System Template (the path for 
which would go into the app bundle, thus handling the possibility that each LyX 
version will have its own templates) and New from User Template, and then 
adding also a Save as Template which path goes to the same place as New from 
User Template. And the user templates would then sensibly be stored in 
  /Users/someuser/Library/Application Support/LyX-2.1/templates
or
  /Users/someuser/Library/Application Support/LyX/templates
since the user would probably want to keep the same templates across versions 
of LyX.

BTW, LyX does a good job of managing preferences for different versions, e.g.
  /Users/someuser/Library/Application Support/LyX-2.0/
and
  /Users/someuser/Library/Application Support/LyX-2.1/

As far as modifying the file dialog with a button, I know that it is possible 
to customize the file dialog since many programs do that.

Jerry
> 
> Of course it's possible to make templates lookup behaving like examples. 
> Perhaps this is better
> than the current state. But you'll loose the direct access to your user 
> templates.
> 
> Stephan
> 
>> 
>> Or alternately, have the templates installed in (assuming a user named jb)
>> /Users/jb/Library/Application Support/LyX-2.1/templates
>> and, for consistency, the examples installed in
>> /Users/jb/Library/Application Support/LyX-2.1/examples
>> and hardwire both paths to each of these locations, respectively.
>> 
>> I don't care which it is but both should be easy to do.
>> 
>> The current work-around is to manually hardwire the Document Templates path 
>> to
>> /Applications/Words/LyXOuterFolder/LyX 2.1.0 beta 
>> 2/LyX.app/Contents/Resources/templates/
>> and then remember to change it if the application moves.
>> 
>> Jerry
> 

Reply via email to