Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.8K Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How can I save a notebook and reload with same line numbers?

When I work on a notebook, as I edit equations, the line numbers increment, and some lines are deleted or I delete them. But I often reference line numbers in later calculations. That works as long as the notebook is open, but when I save it and reload it, the numbers change when Mathematica does a recalculation. This messes up the recalculation. Is there any way to get Mathematica to keep the numbers as they are when the notebook is closed?

POSTED BY: Thomas Fowler
3 Replies
Posted 3 years ago
POSTED BY: Eric Rimbey

Yes I know that I can do that, but assigning a name to every line is very inefficient and inconvenient. Even the old Derive program could easily handle line deletions and other renumberings, and programs reloaded from disc files executed perfectly. This is basic stuff. Wolfram needs to fix this problem.

POSTED BY: Thomas Fowler
Posted 3 years ago

Line numbers are tracked by the kernel. When the kernel quits the line numbers are lost. Explicitly referring to line numbers in a notebook is a bad idea. It is much better to assign meaningful names to the result of an evaluation and use those names in subsequent computations. The resulting code is much easier to understand, debug and maintain.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard