I want to export a cell's input (the text of the command) as pdf/eps. I have used
Export["cell.pdf", cells[[1]]]
It works fine, however, I would like to change the width after which a line break appears. When exporting whole notebook as pdf, I can change margins of the page and the line breaks are performed accordingly, however, it does not affect this kind of export. This export does not seem to follow neither working nor printout styles.
Is there any way how to force a particular width of the exported pdf while having the same size of letters?
I tried ImageFormattingWidth
as in this example of what I precisely want (but without Rasterize
in pdf), it had no effect.
I am aware of partially duplicating this question which, however, have not been answered and do not include any examples.
I am using Mathematica 10.4.
An example of cells[[1]]
is
Cell[BoxData[ RowBox[{RowBox[{"g", "=",
RowBox[{"{",
RowBox[{RowBox[{"{",
RowBox[{RowBox[{"1", "-",
FractionBox[
RowBox[{RowBox[{"2", " ", "M", " ", "r"}], "-",
SuperscriptBox["Q", "2"]}], "\[Rho]2"]}], ",",
RowBox[{"-", "1"}], ",", "0", ",",
FractionBox[
RowBox[{"a", " ",
RowBox[{"(",
RowBox[{RowBox[{"2", " ", "M", " ", "r"}], "-",
SuperscriptBox["Q", "2"]}], ")"}], " ",
SuperscriptBox[RowBox[{"Sin", "[", "\[Theta]", "]"}],
"2"]}], "\[Rho]2"]}], "}"}], ",",
RowBox[{"{",
RowBox[{RowBox[{"-", "1"}], ",", "0", ",", "0", ",",
RowBox[{"a", " ",
SuperscriptBox[RowBox[{"Sin", "[", "\[Theta]", "]"}],
"2"]}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"0", ",", "0", ",", RowBox[{"-", "\[Rho]2"}], ",",
"0"}], "}"}], ",",
RowBox[{"{",
RowBox[{FractionBox[
RowBox[{"a", " ",
RowBox[{"(",
RowBox[{RowBox[{"2", " ", "M", " ", "r"}], "-",
SuperscriptBox["Q", "2"]}], ")"}], " ",
SuperscriptBox[RowBox[{"Sin", "[", "\[Theta]", "]"}],
"2"]}], "\[Rho]2"], ",",
RowBox[{"a", " ",
SuperscriptBox[RowBox[{"Sin", "[", "\[Theta]", "]"}],
"2"]}], ",", "0", ",",
RowBox[{"-",
FractionBox[
RowBox[{"\[CapitalSigma]2", " ",
SuperscriptBox[
RowBox[{"Sin", "[", "\[Theta]", "]"}], "2"]}],
"\[Rho]2"]}]}], "}"}]}], "}"}]}], ";"}]], "Input", CellChangeTimes -> {{3.67481*10^9, 3.67481*10^9}}]