Come convertire una cella di output in una cella di testo senza avere "" nel testo?

Aug 18 2020

Questo fa parte del mio codice:

Grid[{{"Número de indivíduos", "Máximo", "Mínimo", "Mediana", "Média", "Desvio Padrão"}},
Dividers -> Center] // TextCell // CellPrint

E il risultato che ottengo è questo:

"Número de indivíduos" | "Máximo" | "Mínimo" | "Mediana" | "Média" | "Desvio Padrão"

Ma voglio ottenere questo risultato senza virgolette, come posso farlo?

Risposte

1 CarlWoll Aug 19 2020 at 19:05

Fondamentalmente, ciò che controlla se una stringa mostra o meno virgolette è l' Cellopzione ShowStringCharacters. Per le celle di output, questa opzione è impostata su False:

CurrentValue[{StyleDefinitions, "Output", ShowStringCharacters}]

Falso

Quindi, le celle di output non mostreranno le virgolette:

Grid[
    {{"Número de indivíduos", "Máximo", "Mínimo", "Mediana", "Média", "Desvio Padrão"}},
    Dividers -> Center
] // TextCell

Se insisti nell'usare CellPrintanche:

Grid[
    {{"Número de indivíduos", "Máximo", "Mínimo", "Mediana", "Média", "Desvio Padrão"}},
    Dividers -> Center
] // TextCell //CellPrint

quindi crei il seguente Celloggetto (puoi vederlo usando Cell | Show Expressiondal menu):

Cella [BoxData [TagBox [GridBox [{{"" <N [UAcute] mero de indiv [IAcute] duos> "", "" <M [AAcute] ximo> "", "" <M [IAcute] nimo> " "," "<Mediana>" "," "<M [EAcute] dia>" "," "<Desvio Padr [ATilde] o>" "}}, AutoDelete-> False, GridBoxDividers -> {" Columns "- > {False, {True}, False}, "Rows" -> {False, {True}, False}}, GridBoxItemSize -> {"Columns" -> {{Automatic}}, "Rows" -> {{Automatic }}}], "Grid"]], GeneratedCell-> True, CellAutoOverwrite-> True, CellChangeTimes -> {3.806851714647841 * ^ 9}]

Si noti che questa cella non ha un tipo (ad esempio, "Output") come secondo argomento, come lo è il secondo argomento GeneratedCell -> True. Quindi, il valore dell'opzione è l'impostazione predefinita:

CurrentValue[ShowStringCharacters]

Vero

Questo è il motivo per cui l'aggiunta CellPrint(che è completamente inutile) mostra le virgolette. Se devi davvero usare CellPrint, puoi cambiare il tuo TextCellper specificare questa opzione:

TextCell[
    Grid[
        {{"Número de indivíduos", "Máximo", "Mínimo", "Mediana", "Média", "Desvio Padrão"}},
        Dividers -> Center
    ],
    ShowStringCharacters->False
] //CellPrint

IntellectualDilettante Aug 19 2020 at 02:20

Uscita con stile "Stampa"

Griglia [{{"Text 1", Style ["Text 2", RGBColor [0.8, 0.35, 0], Bold, FontFamily -> "Franklin Gothic", FontSize -> 17], "Text 3", Style ["Text 4 ", RGBColor [0, 0,5, 0,5], FontFamily ->" Garamond "FontSize -> 20]}}, Dividers -> All] // Print