Tomato roots can go down more than two feet and will spread sideways as well. It is easier to space them too. In a small garden large plants take up a lot of the space and it more efficient to save that space for plants that take closer spacing like lettuce, beets, radishes. only 2 tomatoes will fit in the back of a 4 ft wide box if you trellis it up. It still needs a couple of feet in front of it because tomato vines need to be continuously trained and the suckers are going to fall. unless you keep cutting them off. Peppers can be planted 12 inches apart but 18 inches is better for air circulation.
I have 3 -18 gallon buckets for tomatoes.outside of the veggie garden. It takes up about 10 linear feet. I have 7 FT high x 12 ft long CRW. The ends of the fencing are wrapped around the end buckets forming cages with the third buket with the fencing in back of it. I have given them more space as I have room to get between the buckets for weeding and picking the tomatoes.
Anything that is goin over 2 ft probably has a root at least that long. Vines can be grown in a raised bed but you will have to either train them up or let them sprawl outside of the garden.
Asian greens, lettuce 8-10 inches
beets, spinach 3-4 inches
green onions, carrots -2 inches
onions 3-4 inches
cucumber - 4 in a hill with a vertilcal trellis. I stack two tomato cages and reinforce them with long stakes. depending on the size of the trellis it can be as small as 1 square foot.
Broccoli, zucchini, kale, cabbage, bush cucumber, bush squash 30-36 inch circle
Corn in a block of at least 4x4 dimension. 8-12 inches apart.