17
$\begingroup$

It seems since v12.1 a new doc type, tech note, is included in the documentation.

However, I cannot find an index page for the tech notes. So how can I list all such tech note pages?

$\endgroup$
19
$\begingroup$

The old documentation center used to have index pages for things like tech notes, but that seems to be absent in version 12.1. But until they reappear...

"Tech note" in 12.1 is not so much a first-class concept as it is a qualifier applied to tutorials. Tutorial types are identified by a certain style of Cell in the notebook that holds each documentation page, PacletNameCell.

We can use this observation to determine the type of any particular tutorial notebook:

tutorialType[nb_] :=
  First[Import[nb, {"Cells", "PacletNameCell"}], {None}][[1]]

The tutorial documentation folder in the Mathematica installation contains all of the tutorial notebooks (including tech notes):

$tutorialNotebooks =
  {$InstallationDirectory, "Documentation", $Language, "System", "Tutorials"} //
  FileNameJoin //
  FileNames["*.nb", #]&;

We can bring this all together by grouping the tutorials by type, creating documentation hyperlinks for each and displaying the results in a Dataset:

$tutorialNotebooks //
Map[<| "Title" -> Hyperlink[#, "paclet:tutorial/"~~#]&@FileBaseName[#]
     , "Type" -> tutorialType[#]
     |>&] //
GroupBy[Key["Type"] -> KeyDrop["Type"]] //
KeySort //
Dataset

Dataset screenshot

We can use the Dataset functionality to drill down into the TECH NOTE type and click on the hyperlinks to open the corresponding documentation pages:

Drill-down screenshot

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ BTW, I just learned that First accepts an optional argument - pretty neat! $\endgroup$ – Victor K. Apr 8 at 0:08
11
$\begingroup$

This is not very scientific, but here is one option. Converting this to an idiomatic Wolfram Language solution is left as an exercise to the reader :).

cd /Applications/Wolfram\ Desktop.app/Contents/Documentation/English/System/Tutorials
grep "TECH NOTE" *.nb | cut -f 1 -d :

A little experimentation shows that just typing the filename, such as MountingACDOrDVDOnLinux, in the search box will yield the tech note in the first few results.

Update. All right, all right! Let's capture these filenames and convert them for easier reading

SetDirectory[
  FileNameJoin[{$InstallationDirectory, "Documentation", "English", 
    "System", "Tutorials"}]];
filenames = 
  FileBaseName@First@StringSplit[#, ":"] & /@ 
   StringSplit[
    RunProcess[{"sh", "-c", "/usr/bin/grep \"TECH NOTE\" *"}][
     "StandardOutput"], "\n"];
link[s_] := <|"Tech Note" -> Hyperlink[
     StringReplace[
      s, (x : _ ~~ y : RegularExpression["[A-Z]"]) :> (x <> " " <> y)],
     "paclet:tutorial/" <> s]|>;
technotes = Dataset[link /@ filenames];

and create an interactive interface to search for specific tech notes (in their filename). Each link is clickable and opens the corresponding documentation page!

Manipulate[
 technotes[
  Select[StringContainsQ[First@#["Tech Note"], search, 
     IgnoreCase -> True] &]],
 {search, ""}]

enter image description here

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ Snap! I guess we had the same idea :) +1 $\endgroup$ – WReach Apr 8 at 0:05
  • $\begingroup$ Yes - and I really like the grouping by the tutorial type. I thought Importing all these notebooks would take considerable time (vs. straightforward grep) but it's actually not that bad. $\endgroup$ – Victor K. Apr 8 at 0:06
3
$\begingroup$

The same idea for guide pages

guideNotebooks = {$InstallationDirectory, "Documentation", $Language, 
 "System", "Guides"} // FileNameJoin // FileNames["*.nb", #] &;

guideLinks = guideNotebooks // 
  Map[<|"Guide Pages" -> Hyperlink[#, "paclet:guide/" ~~ #] & @
    FileBaseName[#]|> &] // Sort // Dataset

(* Searchable *)
Manipulate[
  guideLinks[Select[StringContainsQ[First@#["Guide Pages"], search, IgnoreCase -> True] &]],
  {search, ""}]
| improve this answer | |
$\endgroup$
  • $\begingroup$ This information should all be contained all within something like NotebookInformation though. I would expect somehow there’s an internal function that would prevent the need to have to seemingly home-brew so much of this. One example of what I mean is that within Options of the NotebookObject returned by SelectedNotebook, there is an entry for the ”uri” that can be used to automatically/programmatically make the necessary hyperlinks. However, +1 for this answer :) $\endgroup$ – CA Trevillian May 18 at 3:37

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.