I've searched and have been unable to find the answer to this. It's a pretty basic question and something you see a lot in USA crime/law dramas. A person takes the stand under oath, under examination the individual from the opposing side badgers and forces the person to simply say, "yes or no," to the question at hand. This is also seen with expert testimonies where a simple yes or no will very likely misconstrue the truth as the world is not black and white. Is this sort of thing actually legal? Or can the person insist on giving a more complete testimony?
There are a number of manipulative things that an attorney can do (on cross-examination, to an opposing witness): badgering, leading, and limiting testimony to yes-no responses. The ABA describes "Qualities of a good cross-examination", which encourages questions answered "no". For instance, opposing counsel may ask "You have never used the Mark 4 Toxotron in your life, is that correct?", and you could want to answer "No, because it is well-known that the Mark 4 Toxotron is unreliable, so we use the Mark 6 Toxotron", but if you're limited to "yes" and "no", the answer "No" might make you look like an inexperienced noob. On redirect (if the attorney is on top of things) you can be asked "Why have you not used the Mark 4 Toxotron?".
There may be something in the form of a question that makes it impossible to answer. In the above question, "Yes" could mean "Yes, that is correct" or "Yes, I have used is"; likewise, "No" could mean "No, that is not correct, I have used it" vs. "No, I haven't". It is important to not give the wrong answer, since perjury is a serious crime, so it is important that a witness be allowed to give an unambiguously true answer. The attorney who called you to testify is not your attorney, and has no obligation to protect you from such tricky questions. You may state that you don't understand the question, which can provide an opportunity for elaboration. Although a judge is unlikely to slap a witness for saying more than "Yes" or "No" in that circumstance, you can also refuse to testify on 5th Amendment grounds (any answer, under the circumstance, could be used as evidence against you in a perjury trial – this has happened, probably more than once). A witness may detect that a question has a false presupposition ("Did you use the Mark 6 Toxotron to prepare your subjective analysis?" – "No" is perjury, and "Yes" testifies that the analysis is subjective). If you understand that, you can inform the judge that it is impossible for you to answer the question (though typically witnesses do not understand about "presuppositions").
This is a question of civil procedure more so than law. The customs and practices of civil procedure are established by legal precedent, not laws made by legislatures.
In general, a witness can answer a question however they want as long as it is responsive to the question. Litigators will attempt to bully a witness into certain types of answers, but this is not "illegal" nor is it "illegal" for witnesses to craft their answers as they like.
As for yes-no bullying there are two general cases:
(1) The question is factual. If the questioner asks a purely factual question, like "Did you go to the factory on that Tuesday?" then a yes-no answer can be compelled. If the witness tries to explain why he went to the factory, or something, then he can be cut off, because he is being unresponsive.
(2) The question is hypothetical. If the question is hypothetical or suppositional, then the witness can reject the question. For example, if the question, "You told your boss that you hated your wife, isn't that right?" In this case the witness can answer, "I reject the question, the prosecutor is putting words in my mouth." or can say "I resent the implication." or "That does not accurately reflect what happened." or whatever. Any time a question "paints a picture" or establishes something hypothetical and simply asks the witness to agree with the fantasy scenario, the witness can refuse to answer, or can answer with a counter scenario which they consider to be more accurate.
I would add that in case (2) where a questioner tries to paint a false scenario, it is a risky move, because it opens the door for the witness to say whatever they want. For example, imagine this exchange in the courtroom:
Prosecutor: "You told your boss that you hate your wife, isn't that right?"
Witness: "What actually happened is..."
Prosecutor: "That is a yes or no question, answer yes or no."
Witness (to judge): "Your honor, the question mischaracterizes the conversation I had with my boss, I want to explain what actually was said."
Judge: "The witness may proceed with his answer."
Prosecutor: "I withdraw the question."
Defender: "The prosecution has opened the door, let the witness answer."
Judge: "The witness will answer the question."
So, now the witness has permission to answer however he likes, and the prosecutor has blundered by making a vague question that created the situation where that was possible.
The main thing a witness has to do is not try to say irrelevant things or try to add information beyond what was asked for, in that case the questioner can cut them off.
Well, a witness swears to tell the "whole" truth, not just "the truth". It may be that yes/no simply does not, from a witness perspective, capture the "whole truth" of their testimony on the point. A witness who says so, may at least get the judge to comment on it, and a stubborn witness who takes legal duty as serious stuff, could conceivably respond that they cannot answer it "yes/no".
How the court takes it, and whether the witness has the nerve to say so, is another matter. Ideally any important points should be raised by the other lawyer anyhow.