LaTeX How to determine leaving space after \

  • Thread starter Thread starter mech-eng
  • Start date Start date
  • Tags Tags
    Space
AI Thread Summary
The discussion centers on the use of the backslash (\) as an escape character in programming, particularly in LaTeX. It highlights that the placement of spaces around backslashes is crucial for code functionality. For example, when using double backslashes (\\), it can lead to a newline effect, while a backslash followed by a hash (#) produces a different outcome, affecting the closing syntax of commands. The importance of spacing is emphasized, as removing spaces can cause errors in rendering. Additionally, the conversation touches on the need for resources to better understand these programming concepts, especially for those who may have difficulty accessing standard educational sites like Wikipedia. The discussion encourages exploring specific links related to LaTeX for deeper learning about escape characters and their implications in code.
mech-eng
Messages
825
Reaction score
13
Would you explain when the space should be left when backslash, \, is used?

For example some codes using backslash.
\ \displaystyle a=\frac{dv}{dt} \ : This one works good because there is space between the first two backslashes.

But if the space between the first backslash is removed the code does not work
##\\displaystyle a= \frac{dv}{dt} \##

And there should be a space between the last backslash and the last numbersign pair, ##.
Would you please explan this?

Thank you.
 
Last edited:
Physics news on Phys.org
\ is what is known as an escape character. In the example where it doesn't work, you have \\, which corresponds to a newline, and \# which produces #, so that the closing ## is not present.
 
##\ \displaystyle a=\frac{dv}{dt} \ ##

##\\displaystyle a= \frac{dv}{dt} \ ##

Here that square does not appear.

Thank you.
 
mech-eng said:
Here that square does not appear.
Because you left a space between \ and #.
 
DrClaude said:
\ is what is known as an escape character. In the example where it doesn't work, you have \\, which corresponds to a newline, and \# which produces #, so that the closing ## is not present.

Sorry for my being amateur, but to understand this answer will take some time for me and the questions might cause some new ones. This means you might get tired.

What if double \\ corresponds to a new line? I do not know this case. You might give me a link explaning this basic programming step, \\, so that I could learn by reading.

P.S: I cannot access wikipedia because of some political reasons but I migth try google cache.Thank you.
 
mech-eng said:
What if double \\ corresponds to a new line? I do not know this case. You might give me a link explaning this basic programming step, \\, so that I could learn by reading.
You seem to have found some links on your own. But this is language specific, so let's stick to LaTeX. One a \ appears in LaTeX, what happens depends on what immediately follows it.
mech-eng said:
P.S: I cannot access wikipedia because of some political reasons but I migth try google cache.
Just Google "escape character".
 

Similar threads

Replies
3
Views
2K
Replies
3
Views
2K
Replies
3
Views
2K
Replies
2
Views
10K
Replies
4
Views
1K
Back
Top