Historians debate this, as what surviving Latin documents we have are either ambiguous; or presuppose knowledge which has been lost over time; or both.
Beyond the broad layout as (depending on period) cohorts, maniples, and centuries, in lines of hastati, principes and triarii in the earlier period, we know little beyond Caesar choosing to "thin" his line at Pharsalus to avoid being overlapped.
At the same time, having noticed the arrangements mentioned above, fearing lest his right wing should be surrounded by the multitude of cavalry, [Caesar] hastily withdrew individual cohorts from the third line and out of these constructed a fourth line, stationing it opposite the cavalry, explaining what his object was and reminding them that the day's victory depended on the valour of these cohorts.
Reading this, it's even unclear to me how "from the third line" should be interpreted. The preceding but one sentence has just described three wings in left, right, and centre, and he now describes the ad hoc formation of what is clearly a fourth wing, refused on his right to counter Pompeius' cavalry opposite. The next sentence muddies further, rather than clarifying:
At the same time he commanded the third line and the whole army not to join battle without orders from himself, saying that when he wished this to be done he would give the signal with a flag.
Why is the third line being emphasized here? Perhaps the original Latin helps - but more likely, to me, is that the translator has attempted to interpret as best possible. The constant, apparent at least, conflation of wings with lines clearly presupposes basic understanding of terminology and practice lost to time.