# EDIT:
It appears the 3D case may be hopeless. After Mathematica 10.0 it appears 3D graphics is always rasterized when exporting to vector graphics and there's no good way around it. Full discussion here: https://mathematica.stackexchange.com/questions/87733/export-plot3d-in-mathematica-10-1-is-rasterized-by-default. They provide some workarounds in there, but none of them seem to work for me. It appears having a rasterized element will trigger the entire PDF to rasterize even in the proposed workarounds (e.g. using right-click, print graphic or insetting into a 2D `Graphics`). I believe this is simply a Mathematica limitation, which is a shame. If you have a way to revert to Mathematica 10.0 or before, my approach or another approach given in that answer, might work for you.
# Original Answer:
Here's a simple approach that gives vectorized axes and labels but a rasterized graph. Basically just make your graph without the axes or labels, `Rasterize` that, then add that image as an `Inset` in `Graphics` with the appropriate axes and labels. So for your 2d case (MaTeX was giving me problems so I omitted it):
```
graph = DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3},
PlotPoints -> 200, ImageSize -> 200, ColorFunction -> Hue,
Frame -> False];
im = Rasterize[graph, Background -> None, ImageSize -> 400];
Graphics[Inset[im, {-4, -3}, {0, 0}, {8, 6}],
PlotRange -> {{-4, 4}, {-3, 3}}, Frame -> True,
LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 16},
FrameLabel -> (Style[#, FontSize -> 17] &) /@ {"X", "Y"},
AspectRatio -> 1, ImageSize -> 300]
```
[![2d][1]][1]
For the 3d case:
```
graph3D =
Plot3D[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, PlotPoints -> 200,
ImageSize -> 200, ColorFunction -> Hue, BoxRatios -> {1, 1, 2},
ViewPoint -> {1, -1.3, 0.5}, Axes -> False, Boxed -> False,
Background -> Opacity[0]];
im3d = Rasterize[graph3D, Background -> None, ImageSize -> 200];
Graphics3D[Inset[im3d], PlotRange -> {{-4, 4}, {-3, 3}, {-1, 1}},
AxesEdge -> {{-1, -1}, {1, -1}, Automatic},
LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 16},
Axes -> True,
AxesLabel -> (Style[#, FontSize -> 17] &) /@ {"X", "Y"},
ImageSize -> 250, BoxRatios -> {1, 1, 2},
ViewPoint -> {1, -1.3, 0.5},
FaceGrids -> {{0, 1, 0}, {-1, 0, 0}, {0, 0, 1}, {0, 0, -1}},
Boxed -> False]
```
[![3da][2]][2]
If you want to keep all the options from `PlotTheme -> "Detailed"` you can make a "graph" with a trivial, transparent graph so you're just left with the axes, grids, and labels then `Show` that together with the `Rasterize`d image. I.e.
```
axes3D = Plot3D[0, {x, -4, 4}, {y, -3, 3}, PlotPoints -> 2,
LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 16},
AxesLabel -> (Style[#, FontSize -> 17] &) /@ {"X", "Y"},
ImageSize -> 200, ColorFunction -> (Opacity[0] &), Mesh -> None,
BoundaryStyle -> None, BoxRatios -> {1, 1, 2},
ViewPoint -> {1, -1.3, 0.5}, PlotTheme -> "Detailed"];
Show[axes3D, Graphics3D[Inset[im3d]], ImageSize -> 250]
```
[![3db][3]][3]
There's a lot of playing around with these approaches you can do to get the styling you like. `Inset` can be a bit finicky when you resize things, but it shouldn't be hard to set the options in `Inset` and `Graphics` such that it looks like you want. Plus this has the advantage that you can explicitly control what gets rasterized and what stays vectorized.
Here's a super zoomed in version of the final PDF of the 2d plot. As you can see, the axes are indeed vectorized.
[![zoom2d][4]][4]
[1]: https://i.sstatic.net/lUwDQ.jpg
[2]: https://i.sstatic.net/kUQFB.jpg
[3]: https://i.sstatic.net/OXMaX.jpg
[4]: https://i.sstatic.net/Gp2i9.png