You can use $esc.neither its synonym $esc.newlinefrom EscapeTool for this:
#set($some = $a + $esc.n + $b)
How to run the tools:
ToolManager velocityToolManager = new ToolManager();
velocityToolManager.configure("velocity-tools.xml");
VelocityContext context = new VelocityContext(velocityToolManager.createContext());
You can get default-tools.xml by default from here (it is also included in the jar tool) and enable the necessary tools.
source
share