Function Repository Resource:

CenterNotebookOnNotebook

Source Notebook

Move one notebook to be concentric with another

Contributed by: Bradley Ashby

ResourceFunction["CenterNotebookOnNotebook"][target]

moves the current evaluation notebook so it is concentric with the notebook target.

ResourceFunction["CenterNotebookOnNotebook"][nb,target]

move the notebook nb so it is concentric with target.

Details

ResourceFunction["CenterNotebookOnNotebook"] will not move a notebook so that is off screen or split between two screens.

Examples

Basic Examples (2) 

Center this notebook behind a new notebook:

In[1]:=
ResourceFunction["CenterNotebookOnNotebook"][
 CreateDocument[{a, b, c}, WindowTitle -> "First"]]

Move this notebook to the location of the next clicked notebook:

In[2]:=
ResourceFunction["CenterNotebookOnNotebook"][
 ResourceFunction["ClickedNotebook"][]]

Scope (2) 

Create a new notebook:

In[3]:=
nb = CreateDocument[{x + y, 1/x + 1/y}]
Out[3]=

Move the new notebook on top of this notebook:

In[4]:=
ResourceFunction["CenterNotebookOnNotebook"][nb, EvaluationNotebook[]]
SetSelectedNotebook[nb]
Out[5]=

Applications (2) 

Create a MessageDialog centered over the current notebook:

In[6]:=
nb = MessageDialog["text", Visible -> False];
ResourceFunction["CenterNotebookOnNotebook"][nb, EvaluationNotebook[]];
SetOptions[nb, Visible -> True];
SetSelectedNotebook[nb];

Find and recenter the last notebook you used:

In[7]:=
ResourceFunction["CenterNotebookOnNotebook"][Notebooks[][[2]], EvaluationNotebook[]]
SetSelectedNotebook[nb]
Out[8]=

Publisher

Bradley Ashby

Version History

  • 1.0.0 – 04 October 2022

Related Resources

Author Notes

Future support could include: - allowing the notebook to be split between two screens, with an option - adjust the margins instead of failing when the notebook would be moved off screen

License Information