Aims. We search for muon neutrinos in coincidence with gamma-ray bursts with the ANTARES neutrino detector using data from the end of 2007 to 2011. Methods. Expected neutrino fluxes were calculated for each burst individually. The most recent numerical calculations of the spectra using the NeuCosmA code were employed, which include Monte Carlo simulations of the full underlying photohadronic interaction processes. The discovery probability for a selection of 296 gamma-ray bursts in the given period was optimised using an extended maximum-likelihood strategy. Results. No significant excess over background is found in the data, and 90% confidence level upper limits are placed on the total expected flux according to the model.