Text FormattingForcing Latin charcters within listings

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
mhden
Posts: 2
Joined: Sat Mar 06, 2021 10:01 pm

Forcing Latin charcters within listings

Post by mhden »

Hello i am having a problem with my code , i am trying to use lstlisting to shpw some Javascript code that is used
in ReactNative

\begin{lstlisting}[style=htmlcssjs]

import * as React from 'react';
import {StyleSheet, View, Text,Image, Button,TextInput, CheckBox,KeyboardAvoidingView, Alert} from 'react-native';

import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import Login from './login';
import Connect from './connection';

const Stack = createStackNavigator();

function Nav() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Connect" component={Connect} />
</Stack.Navigator>
</NavigationContainer>
);
}

export default Nav;


\end{lstlisting}




But it shows up with greek chacters rather than latin . I am guessing its because its default to greek ,Is there a way to force latin charcters within the listing ?
codelist.jpg
codelist.jpg (42.73 KiB) Viewed 2098 times
Thanks for your time
MHDEN

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

mhden
Posts: 2
Joined: Sat Mar 06, 2021 10:01 pm

Forcing Latin charcters within listings

Post by mhden »

I found the solution i just had to add

\selectlanguage{english}

before the /begin listing

and

\selectlanguage{greek}

after .
Post Reply