BUG: Fix to_latex with longtable (#17959)
- [x] closes #17959
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

pandas.DataFrame.to_latex(longtable=True) always contained `\multicolumn{3}{r}{{Continued on next page}}` regardless of the number of columns in the output. This is now changed to use the actual number of columns in the output.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=h1) Report
> Merging [#17960](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ae74c2b11580af2e6636f24871e0bc331fd4fad5?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/17960/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17960      +/-   ##
==========================================
- Coverage    91.6%   91.58%   -0.02%     
==========================================
  Files         153      153              
  Lines       51306    51306              
==========================================
- Hits        46998    46990       -8     
- Misses       4308     4316       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.44% <100%> (ø)` | :arrow_up: |
| #single | `40.72% <0%> (-0.12%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/17960/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.17% <100%> (+0.14%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17960/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17960/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.81% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/17960/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.59% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=footer). Last update [ae74c2b...930471d](https://codecov.io/gh/pandas-dev/pandas/pull/17960?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 @syxolk : You just need a `whatsnew` entry, and this should be good to go. I just added the whatsnew entry and squashed the commits. @syxolk : That's great!  @jreback PTAL can you rebase & update can you update? @jreback : I can carry this to the finish line. > @jreback : I can carry this to the finish line.

Thanks! Sorry, I was quite busy. @jreback : All changes have been addressed.  PTAL. thanks @syxolk @gfyoung 