Length Contraction and Simultaneity Exercise I came across a simple special relativity exercise in the book

Relativity, Gravitation and Cosmology - A Basic Introduction 2nd Edition, Ta-Pei Cheng

which I have problem fully understanding.
Let me first "derive" length contraction as they do in the book

Section 2.2.3
The length $\Delta x$ of a moving object, compared to the length
$\Delta x'$ of the object as measured in its own rest frame $O'$,
appears to be shortened. This penomenon is often called the
FitzGerald-Lorentz contraction in the literature:
$\Delta x = \frac{\Delta x'}{\gamma} \quad \gamma > 1 \tag{1}$
Consider the specific example of length measurement of a railcar. Let
there be a clock attached to a fixed marker on the ground. A ground
observer $O$, watching the train moving to the right with speed $v$,
can measure the length $L$ of the car by reading off the times when
the front and back ends of the railcar pass this marker on the ground:
$L = v(t_2 - t_1) \equiv v\Delta t \tag{2}$
But for an observer $O'$ on the railcar, these two events correspond
to the passing of the two ends of the car by the (ground-) marker as
the marker is seen moving to the left. $O'$ can similarly deduce the
length of the railcar in her reference frame by reading the times from
the ground clock.
$L' = v(t_2' - t_1') \equiv v\Delta t' \tag{3}$
These two unequal time intervals in (2) and (3) are related by the
above considered time dilation $\Delta t' = \gamma \Delta t$, because
$\Delta t$ is the time recorded by a clock at rest, while $\Delta t'$
is the time recorded by a clock in motion (with respect to the
observer $O'$). From this we immediately obtain
$L = v\Delta t = \frac{v\Delta t'}{\gamma} = \frac{L'}{\gamma}
 \tag{4}$
which is the claimed result (1) of length contraction.

Now they have the following exercise

Work out the spacetime coordinates $(x,t)$ of the two light pulses
emitted from the midpoint of a railcar and arriving at the fron and
back ends of the railcar as described in Section 2.2.2 cf. Fig 2.4.

*

*Let the $O'$ coordinates be the railcar observer system, and $O$ the platform observer system. Given $\Delta t' = 0$, use the Lorentz
transformation and its inverse to find the relations among $\Delta t,
 \Delta x$ and $\Delta x'$

*One of the relations obtained in (a) should be $\Delta x = \gamma \Delta x'$. Is this compatible with the derivation of length
contraction as done in Section 2.2.3 (I posted that above)? Explain.


They have the following solutions


*

*Given the Lorentz transformation, as well as its inverse, it is clear that $\Delta t' = 0$ implies $\Delta t = (\beta / c) \Delta x$
and $\Delta t = (\beta/c)\gamma \Delta x'$. These two equalities
require the consistency condition $\Delta x = \gamma \Delta x'$, which
is compatible with the Lorentz transformation with $\Delta t' = 0$

*Our derivation of the length contraction in Section 2.2.3 (I posted that above) would lead us to expect the result of $\Delta x' =
 \gamma^{-1} \Delta x$ because the key input of the two ends of an
object being measured at the same time in the "moving frame" is
satisfied by our $\Delta t' = 0$ condition.


Now I did get the same result for 1. but I don't understand 2. From Section 2.2.3 above I expected $\Delta x = \frac{\Delta x' }{\gamma}$ but using Lorentz transformation with $\Delta t' = 0$ gave me $\Delta x = \gamma \Delta x'$.
I can't see the issue here and I don't understand the argument they make in the solution of 2.
If I see such results, my first thought is to check which of the frames is moving and which is resting but they are the same in Section 2.2.3 and in the exercise, are they not? In both, $O'$ is the rest frame (on the railcar) and $O$ is the observer (on the platform/ground).

Edit: To add more detail to the question, let me go through my solution in more detail.
Let $O'$ be the rest frame and $O$ be the lab frame i.e. $O'$ would be on a train and $O$ would be at e.g. the train station. The train moves with a constant velocity $v$. I.e. the two frames move relative to each other with a constant velocity $\pm v$.
We are looking at two events as described in Fig. 2.4. They are simultaneous in the rest frame $O'$ i.e. $t_1' = t_2' \Rightarrow \Delta t' = 0$
We then have the Lorentz-Transformation
$\Delta x' = \gamma(\Delta x - v\Delta t) \tag{5.1}$
$\Delta t' = \gamma(t - \frac{v}{c^2} \Delta x) \tag{5.2}$
Using $\Delta t = 0$ and 5.2 we get $\Delta t = \frac{v}{c^2}\Delta x$. Plugging that into 5.1 we get $\Delta x' = \gamma(\Delta x - \beta^2\Delta x) = \gamma \Delta x (1-\beta^2) = \gamma^{-1} \Delta x$. So we find
$\Delta x' = \gamma^{-1} \Delta x \tag{6}$
Now my solution above seems to agree with the solution given by the book. Now Subproblem 2 basically asks me to compare this result with the FitzGerald-Lorentz contraction described in Section 2.2.3.
In Section 2.2.3 and in this problem, we use the same notation for the rest frame and the lab frame but we get different results:
$\Delta x_{\text{ex}}' = \gamma^{-1} \Delta x_{\text{ex}} \tag{7.1}$
$\Delta x_{\text{fitz}}' = \gamma \Delta x_{\text{fitz}} \tag{7.2}$
Whereas 7.1 is the one derived here in the exercise and 7.2 derived in Section 2.2.3.
The question now is: Where's the difference?
I think the difference is that in the exercise we do measure the length contraction of two simultaneous ($\Delta t' = 0$) events whereas in Section 2.2.3 we have two non-simultaneous events ($Delta t' \neq 0$).
So the much bigger question arises: How does simultaneity influence length contraction and how should I know which to use when?
I think I also have a hard time seeing why 7.1 and 7.2 should differ. Why should the length depend on how I measure it? What's the conclusion here? I expect length contraction, that's fine but I kind of expect it to be constant between the two frames. I mean if it weren't, there wouldn't be a way to figure out "which clock setup" is the "right" one.
 A: Well! It's the notation that makes you confused.
Let's talk of part (1) first and to make things a little easier to see, I'll use capital letter's to use proper values.
Using $\Delta  t'=0$, you have concluded
$$\Delta x=\gamma \ \Delta X$$

Now for a second concentrate on the section on Length contraction

The measurements are simultaneous in the $O-$system, $\Delta t=0$
$$\Delta x'=\gamma \Delta X$$
The above result is written in the book as $\Delta x'=\gamma \Delta x$ (which is creating the confusion).
which is identical to what we get in the first part.
A: I give my take on this and hope to be helpful. The book's explanation is slightly vague to me, however, be informed that in many textbooks the definition of $x$ or $\Delta x$ (distance) slightly differs from $L$ (length), i.e., they are not necessarily the same, unless their similarity is clearly explained. Assume that there is a rod with a length $L'$ measured in its rest frame of A. If the rod has a velocity $u$ relative to the lab observer B, in the lab frame (using the Lorentz transformation), the rod's length of $L$ is calculated to be: [See the attached Figure.]
$$L=\frac{1}{\gamma}L'.\tag{1}$$

Recall that the measurements shown in the figure are made by B. Now, assume that at a distance $\Delta x$ from B, there is a plate attached to the lab frame. If B and A synchronize their clocks at the time A meets B, in A's rest frame the said distance, i.e., the distance between the plate and A, is measured to be:
$$\Delta x'=\frac{1}{\gamma}\Delta x.\tag{2}$$
The proof for my first equation is available in most of the relevant textbooks, however, I provide the proof of the second equation to you. The Lorentz transformation for $x$ in the above scenario implies:
$$\Delta x'=\gamma (\Delta x+ut),\tag{3}$$
and for $t$, we have:
$$t=\gamma (t'-\frac{u\Delta x'}{c^2}).\tag{4}$$
If we use $t'=0$ in Eq. (4) meaning that all of the clocks attached to A's frame along $x'$ are synchronous in A's frame (esp., the clock which is very close to the location of the plate though at rest in A's frame), the counterpart clock attached to B's frame  at the location of the plate shows a time:
$$t=\gamma (0-\frac{u\Delta x'}{c^2})=-\gamma \frac{u\Delta x'}{c^2}.\tag{5}$$
The negative sign means that when A's clock starts ticking, B's clock starts to work after a time $t=\gamma u\Delta x'/c^2$. Inserting Eq. (5) into Eq. (3), we get:
$$\Delta x'=\gamma (\Delta x-\gamma \frac{u^2\Delta x'}{c^2}).\tag{6}$$
After simplification, we get:
$$\Delta x'=\frac{1}{\gamma}\Delta x,\tag{7}$$
which is compatible with Eq. (2). One of the important differences between length and distance is that the two points between which a length is determined are both at rest or in motion with the same speed in reference frames. However, the points between which a distance is defined are both at rest in one frame, whereas they can have different velocities in another frame. In my example, for instance, if we denote by P the plate, the two points (A,P) of the distance between observer A and the plate have two different velocities. Point A is at rest in A's frame, while P has a velocity $u$. On the other hand, the two points of (B,P) for the same distance in B's frame are both at rest relative to B. In other words, the distance in some ways can be defined as a length varying by time, whereas the length itself is constant.
A: In the first quote, it should be clear that the time dilation used as input to calculate length contraction compares the fixed clock in the ground with different clocks, one at each end of the railcar. This 2 clocks are syncronized in the train's frame. In this case the Lorentz formula:$\Delta t' = \gamma (\Delta t - v\Delta x)$ can be reduced to $\Delta t' = \gamma \Delta t$, because $\Delta x = 0$.
In the second quote, the method of syncronizing this 2 clocks of the railcar is explained. The result of length contraction must be the same because what is being measured is the length of the railcar. It would be another result if the observer in the ground made 2 marks corresponding to the length of the train according his measurement. The distance between that marks would be shorter for the observer in the train.
A: Why does simultaneity affect the measurement of length?
Suppose a train 990m long is heading into a tunnel 1000m long at 100m per second.
You and a friend don't know the length of the train, and are asked to determine whether the train is longer or shorter than the tunnel.
You realise that you can answer the question by observing whether the back of the train enters the tunnel before or after the front of the train leaves it. If it enters afterwards, the train is longer than the tunnel- if it enters before, the train is shorter than the tunnel.
Accordingly, you and a friend stand at either end of the tunnel and make a note of the times when the rear of the train enters the tunnel and the front leaves.
If your watches are accurately synchronised, you will find that the rear of the train enters the tunnel 0.1s before the front leaves it, so the train is shorter than the tunnel.
However, had the watch of the person observing the rear of the train been just 0.2s fast, you would have concluded that the train was longer than the tunnel.
Your ability to measure the moving train depends upon you being able to pin down the respective locations of its two ends at the same moment, ie simultaneously. What is simultaneous for you, however, will not be simultaneous for someone moving relative to you, so they will appear to you to record the positions of the two ends of the train at two different times, and thus their measurement will be different from yours.
