5
$\begingroup$

For lectures I am giving now I developed a special StyleSheet entitled "LectureNote". I, myself, and my students installed it into the directory $BaseDirectory\SystemFiles\FrontEnd\StyleSheets. After that the LectureNote item appears under the Menu/Format/StyleSheets. All my lectures are written and saved in this style.

I expected that all my lecture notes created within this StyleSheet on my desktop will be automatically recognized by my laptop as well as by those of my students (where this StyleSheet is installed in the directory mentioned above).

Alas, it is not the case, and we need to go to Menu/Format/StyleSheets and click LectureNote each time after the lecture notebook is open.

My question: Is it possible to do something to force Mma to automatically recognize the StyleSheet in which the lecture has been created?

$\endgroup$
  • 1
    $\begingroup$ It should recognize it. The thing to do is go use FrontEndTokenExecute@"EditStyleDefinitions" and check the form of that first cell. It should be Cell[StyleDefinitions-><name_of_your_stylesheet>]. $\endgroup$ – b3m2a1 Mar 14 '17 at 7:54
  • $\begingroup$ @MB1965 Thank you for the answer, but I cannot understand what you propose. Could you please kindly be a little bit more precise. You write: "...go use FrontEndTokenExecute@"EditStyleDefinitions" " Please specify, should I execute it from a lecture file, or from somewhere else? You write: "...check the form of that first cell..." What cell do you mean? Of what file? $\endgroup$ – Alexei Boulbitch Mar 14 '17 at 8:23
3
$\begingroup$

After some discussion and research I pinned down the origin of the problem. The directory where I had the StyleSheet in question on one of my two computers was $BaseDirectory\SystemFiles\FrontEnd\StyleSheets, while on the other it was $BaseDirectory\SystemFiles\FrontEnd\StyleSheets\Lectures. It is this difference that gave rise to the unrecognized style. It was the more difficult to notice, that this is a directory one rarely looks at.

The message is, therefore, that the directory where the style is placed must be identical at all computers on which this style is in use.

$\endgroup$
  • $\begingroup$ I'd say the 'relative' directory has to be the same. It will work for whatever dir / Lecures / stylesheet.nb if a dir is on the StyleSheetPath. $\endgroup$ – Kuba Mar 17 '17 at 13:33
  • 2
    $\begingroup$ StyleDefinitions are always set as a path relative to directories on StyleSheetPath, here FrontEnd`FileName[{"Lectures"}, "styles.nb"] since you don't have "Lectures" on StylesheetPath. The end user needs to have styles.nb wherever on directoryInStylesheetPath / Lectures / styles.nb. Which makes "must be identical" too strong statement from your side. $\endgroup$ – Kuba Mar 17 '17 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.