Sorry if this was asked before. I googled and could not find anything.
Many times I need to export a cell to a PDF. It is always the cell above. Currently I do this using the GUI, by selecting the cell first, then File
->Save selection As
then save it to a PDF file.
But sometimes I lose track of what file I saved the cell to (If I do not remember to add a comment).
Is it possible to use the Export command? This way by looking at the command below the cell, I know the name of the file.
With plots and graphics, this is easy to do, since I could do p=Plot[...]
then do Export["plot.pdf",p]
Any suggestions how to do this for cell? It will always be the cell above where the command is issued, if this makes it any easier. (So can't use any hardcoded specific current cell number, since the cell numbers can change when modifying the notebook)
I am using V12 on windows 10.
Export["code.pdf", NotebookRead[PreviousCell[]]]
do what you want? $\endgroup$