Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I give a CellTag to my Input Cell, but the output cell would also inherit the CellTag.

Is it possible to control not inherit the CellTag?

Sometimes I need the output cell with the CellTag, but sometimes I don't need...


Application

I found another method is use another tags to do the same thing.

I want to select some cells with some tags, cells with "Ignore" tag will be omitted, only Input Style Cells with"Ignore1" tag will be omitted, Output Style Cells with "Ignore1" tag will be kept.

for example, I select the cells without "Ignore" and "Ignore1" tags.

Select[NotebookRead@Cells[EvaluationNotebook[]], 
FreeQ[#, CellTags -> "Ignore"]&&FreeQ[#, CellTags -> "Ignore1"] &]

but this omit the output cells with "Ignore1", how to include these output cells?

This is my sub question, if the original question is unsolvable.


so the condition could be.

condition=FreeQ[#, CellTags -> "Ignore"] && (#[[2]] === "Output" && 
MemberQ[#, CellTags -> "Ignore1"]) &

One method

We've add a CellTags->"Ignore" in the Input cell, just add a new CellTag, the the Output cell by CellPrint will tagged by new tag Hello !

CellPrint@Cell["Test",CellTags->"Hello"]

enter image description here

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Main question

I don't think this is possible. You can however delete such CellTags programmatically, using this

SetOptions[#, CellTags -> {}] & /@ 
 Cells[CellTags -> "tag", CellStyle -> "Output"]

Sub question

How about something like this

Complement[Cells[], Cells[CellTags -> "Ignore"], 
 Cells[CellTags -> "Ignore1", CellStyle -> "Input"]]
share|improve this answer
    
yes, the problem is some "Output" style cells need "tag", some doesn't. –  HyperGroups Dec 20 '13 at 7:11
    
@HyperGroups ah that is more specific and harder than I thought. –  Jacob Akkerboom Dec 20 '13 at 10:21
    
I found another method to deal with this situation is Just add another tag1 to the Input Cell. –  HyperGroups Dec 20 '13 at 10:24
    
for example, I select the cells without "Ignore" and "Ignore1" tags. Select[NotebookRead@Cells[EvaluationNotebook[]], FreeQ[#, CellTags -> "Ignore"]&&FreeQ[#, CellTags -> "Ignore1"] &], but this omit the output cells with "Ignore1", how to include these output cells. –  HyperGroups Dec 20 '13 at 10:28
    
I've modified my question include a real application. I think you can develop your answer to make my question and your answer more applicable. –  HyperGroups Dec 20 '13 at 10:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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