This snippet was copied from https://tex.stackexchange.com/a/53540, written by user https://tex.stackexchange.com/users/13971/schlamar and licensed under CC BY-SA 4.0 International.